Passing variables between ASP and Javascript

G

Gung Ho

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.
 
M

Martin Honnen

Gung said:
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).
 
F

Fatbob

This works for me...

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

HTH
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top