Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cookie - Interesting code snippet + Puzzle

Status
Not open for further replies.

Deadline

Programmer
Feb 28, 2001
367
US
Hi,
Please observe the following code...

Code:
Response.Cookies("pPEDATE") = strParkEligDate
		Response.Cookies("pPEDATE").expires = 100
Response.Write &quot;<script language=JAVASCRIPT>alert('&quot; & Request.Cookies(&quot;pPEDATE&quot;)  & &quot;') </script>&quot;

I am setting the Cookie called pPEDATE and trying to read it immediately... I am getting a blank/null in the alert box. But when I display the variable
Code:
strParkEligDate
, I get a proper date... What could be the problem...??
Thanks!

RR


 


the answer is that request.cookie is an asp server-side script...the server must process the asp script first and then pass a variable to the javascript function with the date in it... Bastien

There are many ways to skin this cat,
but it still tastes like chicken
 
Hi Bastien,
Thanks for the reply.. But the code above is a complete server side code enclosed between <%%> . I just forgot to mention that in the above snippet.

Thanks!

RR


 
try requesting the cookie first and assigning the value to a variable then response.write the javascript code to the client with the variable Bastien

There are many ways to skin this cat,
but it still tastes like chicken
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top