470,638 Members | 1,608 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,638 developers. It's quick & easy.

Passing variables between ASP and Javascript

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.
Jul 19 '05 #1
2 10714


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/

Jul 19 '05 #2
This works for me...

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

HTH

"Gung Ho" <mi***********@netlane.com> wrote in message
news:rf********************@golden.net...
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.

Jul 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Consuelo Guenther | last post: by
3 posts views Thread by domeceo | last post: by
9 posts views Thread by Max | last post: by
3 posts views Thread by q-rious | last post: by
???
1 post views Thread by Stoney L | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.