Running a JavaScript function server-side

Discussion in 'ASP General' started by David C. Holley, May 4, 2004.

  1. How would I run a JavaScript function in a *.asp page and then pass the
    value returned to VBScript for further processing? ***Converting the
    function to VBScript is *NOT* an option.
     
    David C. Holley, May 4, 2004
    #1
    1. Advertising

  2. A *client-side* JavaScript function? You can't do that in a single load of
    an ASP page. You would have to submit a form or redirect or something along
    those lines. Here is the order of operations:

    (a) browser requests ASP page

    (b) server-side code runs

    (c) client-side code runs (at this point, there is nothing left but HTML; no
    server-side functions, no access to server-side databases, no ability to set
    session variables, etc)

    See http://www.aspfaq.com/2281 for some workarounds (this revolves around
    setting session variables, but you could use it to do any further
    server-side processing). Note that anything you do on the server (e.g. set
    a session variable) is not available until you request another ASP page,
    because of the order of operations described above. The current ASP page
    simply does not contain any ASP by the time an end user can interact with
    the client-side script.

    --
    Aaron Bertrand
    SQL Server MVP
    http://www.aspfaq.com/


    "David C. Holley" <> wrote in message
    news:...
    > How would I run a JavaScript function in a *.asp page and then pass the
    > value returned to VBScript for further processing? ***Converting the
    > function to VBScript is *NOT* an option.
    >
     
    Aaron Bertrand [MVP], May 4, 2004
    #2
    1. Advertising

  3. David C. Holley

    David Holley Guest

    Let me restate that...

    How would I run a JavaScript function SERVER-SIDE in a *.asp page and
    then pass the value returned to VBScript for further processing?
    ***Converting the function to VBScript is *NOT* an option.

    I seem to recall seeing that a *.asp can execute JavaScript. If I'm not
    mistaken.



    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    David Holley, May 4, 2004
    #3
  4. David Holley wrote:
    > Let me restate that...
    >
    > How would I run a JavaScript function SERVER-SIDE in a *.asp page and
    > then pass the value returned to VBScript for further processing?


    Create a server-side javascript script block in which you place your
    javascript function. then call the function from your server-side vbscript
    script block.

    There is an article at www.aspfaq.com about doing this, but I don't have
    time to search for it right now, so I suggest you do so.

    >
    > ***Converting the function to VBScript is *NOT* an option.
    > I seem to recall seeing that a *.asp can execute JavaScript. If I'm
    > not mistaken.


    You're not mistaken: ASP supports both vbscript and
    jscript/javasctipt/ECMAscript


    Bob Barrows

    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.
     
    Bob Barrows [MVP], May 4, 2004
    #4
  5. Maybe you mean one of these?

    http://www.aspfaq.com/2045
    http://www.aspfaq.com/2208

    --
    Aaron Bertrand
    SQL Server MVP
    http://www.aspfaq.com/




    "Bob Barrows [MVP]" <> wrote in message
    news:eg$...
    > David Holley wrote:
    > > Let me restate that...
    > >
    > > How would I run a JavaScript function SERVER-SIDE in a *.asp page and
    > > then pass the value returned to VBScript for further processing?

    >
    > Create a server-side javascript script block in which you place your
    > javascript function. then call the function from your server-side vbscript
    > script block.
    >
    > There is an article at www.aspfaq.com about doing this, but I don't have
    > time to search for it right now, so I suggest you do so.
    >
    > >
    > > ***Converting the function to VBScript is *NOT* an option.
    > > I seem to recall seeing that a *.asp can execute JavaScript. If I'm
    > > not mistaken.

    >
    > You're not mistaken: ASP supports both vbscript and
    > jscript/javasctipt/ECMAscript
    >
    >
    > Bob Barrows
    >
    > --
    > Microsoft MVP -- ASP/ASP.NET
    > Please reply to the newsgroup. The email account listed in my From
    > header is my spam trap, so I don't check it very often. You will get a
    > quicker response by posting to the newsgroup.
    >
    >
     
    Aaron Bertrand - MVP, May 4, 2004
    #5
  6. Bob Barrows [MVP], May 4, 2004
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?Qw==?=
    Replies:
    1
    Views:
    3,256
    Hermit Dave
    Jan 16, 2004
  2. Shaul Feldman
    Replies:
    0
    Views:
    859
    Shaul Feldman
    Apr 16, 2004
  3. Guadala Harry
    Replies:
    4
    Views:
    1,528
    =?Utf-8?B?aGFyaSBwcmFzYWQ=?=
    Jun 15, 2004
  4. nick
    Replies:
    3
    Views:
    3,216
    Eliyahu Goldin
    Dec 15, 2004
  5. =?Utf-8?B?bGFuZW0=?=
    Replies:
    3
    Views:
    29,323
    Eliyahu Goldin
    Mar 30, 2005
Loading...

Share This Page