How to pass ColdFusion variables to Javascript
Just wrap the <cfoutput></cfoutput> tags around your entire Javascript and then use ColdFusion variables as you would normally.
Example:
<cfset var_name = "Outputting a variable from ColdFusion in JavaScript is easy. Just wrap the <cfoutput></cfoutput> tags around your entire Javascript and then use ColdFusion variables as you would normally.">
<cfoutput>
<script language="javascript" type="text/javascript">
<!--
document.write("#var_name#")
// -->
</script>
</cfoutput>
This will give the following output:
Outputting a variable from ColdFusion in JavaScript is easy. Just wrap the <cfoutput></cfoutput> tags around your entire Javascript and then use ColdFusion variables as you would normally.
Advertisement

No User Comments.
No User Comments, be the first one to write your comments?


