ToScript Output. CF >JS
I'm having some trouble passing a variable from Coldfusion to Javascript.
There are two defined session varaibles which work fine with the ToScript but fail when I try and use them inside the javascript.
<cfset session.ga_usersecret = "testGAUS" />
<cfset session.AIsession = "testGAS" />
<script type="text/javascript">
<cfoutput>
var #toScript(session.ga_usersecret, "GAuser")#
var #toScript(session.AIsession, "GAsession")#
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXX']);
_gaq.push(['_trackPageview']);
_gaq.push(['_setCustomVar', 1,'ID','GAuser',1]);
_gaq.push(['_setCustomVar', 2,'Segment','GAsession',2]);
</cfoutput>
</script>
Viewing the page source shows that the toScript works fine but it's not recognising the varaibles later in the script. Any ideas how to get the JS to output the varibale values?
Thanks in advance.
