ajaxCFC server side JavaScript and dynamic content
Client Side Script
<script type='text/javascript'>_ajaxConfig = {'_cfscriptLocation':'ajaxFacade.cfc', '_jsscriptFolder':'../js'};</script>
<script type='text/javascript' src='../js/ajax.js'></script>
<script type='text/javascript' src='../js/popup/popup.js'></script>

<script type="text/javascript">
	function getContent(win)	{
		
		// send request to CF
		DWREngine._execute(_ajaxConfig._cfscriptLocation, null, 'getContent', win, getContentResult);
	}
	
	// call back function
	function getContentResult (r) {
		// all content and commands are sent from the server.
		eval(r);
	}
	
</script>

	<fieldset>
	<legend>ajaxCFC server side JavaScript and content</legend>
	<input type="button" onclick="getContent('window1');" value="open window 1">
	<input type="button" onclick="getContent('window2');" value="open window 2">
	<input type="button" onclick="getContent('window3');" value="open window 3">
	</fieldset>
	
Server Side Script
<cfcomponent extends="ajax">
	
	<cffunction name="getContent" output="no" access="private">
		<cfargument name="windowID" required="Yes" type="string">
		
		<cfset var returnScript = "" />
		
		<cfswitch expression="#arguments.windowID#">
			<cfcase value="window1">
				<cfsavecontent variable="returnScript">new popUp(10, 100, 250, 150, "<cfoutput>#CreateUUID()#</cfoutput>", "Each of these popup windows can have very different settings. For instance, this window cannot be dragged or resized, but the others can. Take a look at the various colors and fonts used in each one. Read below for the features and instructions.", "white", "#00385c", "16pt serif", "Div1", "#00385c", "white", "lightgrey", "#00568c", "black", true, false, false, true, false, false,'','','img/cir_close.gif','img/resize.gif');</cfsavecontent>
			</cfcase>
			<cfcase value="window2">
				<cfsavecontent variable="returnScript">new popUp(200, 120, 370, 175, "<cfoutput>#CreateUUID()#</cfoutput>", "OK, so these things are pretty neat, but of course they <b>do</b> have a few limitations.<br><br><ol><li>These only work in IE5+ and NS6+. In NS4.x and IE4.x, the script will just open a regular window with most of the settings you specified.<br><br><li>Technically, there are no limits to the number of windows on a page, but the browser may get sluggish if there are too many, so use judgement.<br><br><li>The minimum width allowed is 100 pixels and the minimum height allowed is 80 pixels. Any attempt to go smaller will be ignored. Any titlebar text that exceeds the allotted width will be chopped to fit.</ol><br>", "#00385c", "lightgrey", "9pt sans-serif", "Div2", "#0084d8", "lightgrey", "gray", "#00468c", "black", true, true, true, true, false, false,'img/min.gif','img/max.gif','img/close.gif','img/resize.gif');</cfsavecontent>
			</cfcase>
			<cfcase value="window3">
				<cfsavecontent variable="returnScript">new popUp(450, 140, 300, 200, "<cfoutput>#CreateUUID()#</cfoutput>", "test_1.html", "white", "#00385c", "16pt serif", "Div3 (External HTML Page)", "#00385c", "white", "lightgrey", "#00568c", "black", true, true, true, true, true, false,'img/ar_min.gif','img/ar_max.gif','img/ar_close.gif','img/resize.gif');</cfsavecontent>
			</cfcase>
		</cfswitch>
		
		<cfreturn returnScript />
	</cffunction>
</cfcomponent>
	
description This example illustrates how you can code does not need to exist on the client beyond connection scripts; JavaScript can be sent to browser to be executed. Client sends a request for a content page, and the server returns a JavaScript string that is executed by the callback function.

NOTE: This example is not a full application and is far from perfect. It has no validations, no even listeners, or any advanced functionality. It is only meant to show how to control your JavaScript code in the server side.