Posts

Showing posts with the label coldfusion inside javascript

how to use coldfusion variable in javascript | assigning coldfusion variable to a javascript variable

 There are some cases where we need coldfusion variable inside javascript. We may need to assign the javascript variable with coldfusion variable value. For this, we can use the script tag, as we use in HTML and can assign like given below: Please note that the entire JS code have to be inside <cfoutput> block. <cfset a="10"> <cfoutput>     <script type="text/javascript">         var test = '#a#';         alert(test);     </script> </cfoutput>