Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 passing asp session variable to js function
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Angela French
Starting Member

5 Posts

Posted - 15 April 2002 :  16:56:40  Show Profile
I'm pulling my hair out trying to figure out how to pass an asp session variable to a local variable withing a javascript function. Something like this:

var zip = <%=Session("clzip")%>

but it's the quotes around "clzip" that is throwing a syntax error I think. I've tried single quotes and no quaotes. Can't get it to work. Anyone have any ideas?


Doug G
Support Moderator

USA
6493 Posts

Posted - 15 April 2002 :  18:27:23  Show Profile
First, if you are trying to get the session variable from the browser after the browser has loaded the page, you can't. At that time the server-side processing is completed.

You can however have the asp write the entire js html to your browser.

If it's a textual variable and you need to quote it in the html, try this.
<%
response.write "var zip = ' " & Session("clzip") & " ' "
%>

at the proper place in your asp page.


btw, I added spaces between the quotes so you can read them, don't put them in final code.


======
Doug G
======

Edited by - Doug G on 15 April 2002 18:28:57
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.25 seconds. Powered By: Snitz Forums 2000 Version 3.4.07