Running a JavaScript function server-side

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • David C. Holley

    Running a JavaScript function server-side

    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]

    #2
    Re: Running a JavaScript function server-side

    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



    "David C. Holley" <DavidCHolley@n etscape.net> wrote in message
    news:OZyRvYYMEH A.3216@TK2MSFTN GP12.phx.gbl...[color=blue]
    > 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.
    >[/color]


    Comment

    • David Holley

      #3
      Re: Running a JavaScript function server-side

      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!

      Comment

      • Bob Barrows [MVP]

        #4
        Re: Running a JavaScript function server-side

        David Holley wrote:[color=blue]
        > 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?[/color]

        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.
        [color=blue]
        >
        > ***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.[/color]

        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.


        Comment

        • Aaron Bertrand - MVP

          #5
          Re: Running a JavaScript function server-side

          Maybe you mean one of these?




          --
          Aaron Bertrand
          SQL Server MVP





          "Bob Barrows [MVP]" <reb01501@NOyah oo.SPAMcom> wrote in message
          news:eg$9tUdMEH A.2100@TK2MSFTN GP12.phx.gbl...[color=blue]
          > David Holley wrote:[color=green]
          > > 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?[/color]
          >
          > 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.
          >[color=green]
          > >
          > > ***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.[/color]
          >
          > 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.
          >
          >[/color]


          Comment

          • Bob Barrows [MVP]

            #6
            Re: Running a JavaScript function server-side

            I was thinking of the first one, but the other one is good too.
            Bob
            --
            Microsoft MVP -- ASP/ASP.NET
            ..
            "Aaron Bertrand - MVP" <aaron@TRASHasp faq.com> wrote in message
            news:uxgJetdMEH A.2976@TK2MSFTN GP10.phx.gbl...[color=blue]
            > Maybe you mean one of these?
            >
            > http://www.aspfaq.com/2045
            > http://www.aspfaq.com/2208
            >[/color]


            Comment

            Working...