Banner rotation via Ajax
After viewing a great post from http://www.phpied.com/ajax-banner-rotation/ I've created the back end script in coldfusion. You'll have to download the JS from the post above, as I feel the post is worth a read. The backend code is:
<cfset request.banner[1] = "<p>FREE Delivery</p>" />
<cfset request.banner[2] = "<img src='/images/banner1.gif'/>" />
<cfset request.banner[3] = "<p>Best offers on the net</p>" />
<cfset request.banner[4] = "<p>Visit <a href='http://succor.co.uk'>http://succor.co.uk</a></p>" />
<cfxml variable="request.XMLData"><?xml version="1.0" encoding="ISO-8859-1"?>
<banner>
<content><![CDATA[<cfoutput>#request.banner[randrange(1,4)]#</cfoutput>]]></content>
<reload>11000</reload>
</banner>
</cfxml>
<cfsetting showdebugoutput="no" />
<cfcontent type="application/xml; charset=UTF-8" reset="yes"><cfoutput>#request.xmlData#</cfoutput>
Be sure to change the JS code on line 60 to ajax-banner.cfm then include this code on your page:
div id="ajax-banner">Loading...</div>
Enjoy.





http://www.coldfusionjedi.com/index.cfm/2007/7/26/...