>>When I first loaded the page I received an error, after I refreshed the
error went away.
This method won't work either, because the Ajax function will be executed after
the output of the page is already on client side.
This is why you get an error at the first call. So you have to call the
template two times so it can use the session variable.
Furthermore, I'm not sure the Ajax function will use the same session as the
calling program.
A better way would be to use redirection. Example:
<CFIF NOT isDefined("session.screenWidth")>
<CFIF NOT isDefined("url.sh")>
<SCRIPT>
window.location.href += "?sw=" + screen.width + "&sh=" + screen.height
</SCRIPT>
<CFELSE>
<CFSET session.screenWidth = url.sw>
<CFSET session.screenheight = url.sh>
</CFIF>
</CFIF>
<CFDUMP var="#session#">
You could also work out a POST method version using a FORM to transmit the
values and the submit() function to redirect.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:353653
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm