Hi Dan,

Can you elaborate a bit on point 3 -> Use Image()object in JS to post to
a fixed URL. I know how to do the other 3 (Form, Hidden fields/iframe
and AJAX) but not sure how to do on point 3 that you mentioned. 

Apart from all those you mentioned, you can pass the values in the URL
or Attributes via query string by using window.location to itself (with
different URL or Attributes variables). 

Thanks in advance.

Pine

-----Original Message-----
From: Dan G. Switzer, II [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, February 01, 2006 7:10 AM
To: CF-Talk
Subject: RE: Set session variables in JS?


Eric,

>Is there a specific or easy way to set session variables while in the 
>middle of a javascript routine?  I can't seem to recall...thanks.

JavaScript executes on the client where as CF executes on the server.
You can't have JavaScript directly affect the outcome of the current
running template. That means you can't do:

var aJSVariable = prompt("Your name:");
<cfset session.name = aJSVariable />

Now that's not to say that you can't use JavaScript to change the value
of a session variable for sequential requests. There are a couple of
ways to accomplish this, but they are revolve having the browser talk
back to the
server:

1) Update a form variable and then submit the form back to the server.
2) Use a hidden iframe to post back to a fixed URL to update the server.
3) Use the Image() object in JS to post to a fixed URL to update the
server.
4) Use AJAX to update the server.

-Dan





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:230977
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to