Passing variables between ASP and Javascript

Discussion in 'ASP General' started by Gung Ho, Nov 28, 2003.

  1. Gung Ho

    Gung Ho Guest

    I am using ASP to open a text file on the server and I want to pass
    variables to Javascript.

    Any suggestions?

    For example - I have a text file on the server defining a set of pictures.
    I open the text file to retrieve the list of files. I want to pass the list
    of files to the Javascript which will then display the data on the client
    machine.
     
    Gung Ho, Nov 28, 2003
    #1
    1. Advertising

  2. Gung Ho wrote:

    > I am using ASP to open a text file on the server and I want to pass
    > variables to Javascript.
    >
    > Any suggestions?
    >
    > For example - I have a text file on the server defining a set of pictures.
    > I open the text file to retrieve the list of files. I want to pass the list
    > of files to the Javascript which will then display the data on the client
    > machine.


    Well, you control the server while you don't control the client
    (JavaScript might not be supported or enabled) therefore I am not sure
    why you want client-side JavaScript to display the data. Can't you
    simply use ASP to display the data?
    Of course you can make your ASP page create client side JavaScript code
    but that hardly has advantages.
    If you are looking for a way to exchange data between client side
    JavaScript and ASP without changing the URL of the page displayed in the
    browser then you could use remote scripting or Msxml2.XMLHTTP to
    exchange data. Remote scripting relies on an Java applet I think while
    Msxml2.XMLHTTP works only with IE5+/Win (although Netscape 6/7 has a
    XMLHttpRequest object to do similar).

    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
     
    Martin Honnen, Nov 28, 2003
    #2
    1. Advertising

  3. Gung Ho

    Fatbob Guest

    This works for me...

    var sDocument = new String('<%=sDischargeInstructionDocument%>');

    HTH

    "Gung Ho" <> wrote in message
    news:...
    > I am using ASP to open a text file on the server and I want to pass
    > variables to Javascript.
    >
    > Any suggestions?
    >
    > For example - I have a text file on the server defining a set of pictures.
    > I open the text file to retrieve the list of files. I want to pass the

    list
    > of files to the Javascript which will then display the data on the client
    > machine.
    >
    >
     
    Fatbob, Nov 28, 2003
    #3
    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. shiv
    Replies:
    0
    Views:
    482
  2. Replies:
    10
    Views:
    35,914
    jporter892
    Jun 6, 2011
  3. Consuelo Guenther

    Passing variables from Javascript to ASP

    Consuelo Guenther, Sep 22, 2004, in forum: ASP General
    Replies:
    1
    Views:
    142
    Ray Costanzo [MVP]
    Sep 22, 2004
  4. David E
    Replies:
    1
    Views:
    323
    Ray Costanzo [MVP]
    May 18, 2005
  5. q-rious
    Replies:
    7
    Views:
    165
    Thomas 'PointedEars' Lahn
    Aug 24, 2008
Loading...

Share This Page