Skip to main content
Inspiring
November 10, 2010
Question

ColdFusion 8 and Ajax

  • November 10, 2010
  • 1 reply
  • 693 views

Hi!

I have never used ajax with codlfusion, this would be my first try. I read some  forum, those I need are described here, including the one written by

Ben Forta: http://www.forta.com/blog/index.cfm/2007/5/31/ColdFusion-Ajax-Tutorial-1-AutoSuggest

and also from Adobe site:

http://www.adobe.com/devnet/coldfusion/articles/cfajax_overview.html

At this moment I only need to use a couple of them such as, autosuggest, cflayout, cfmenu and cfwindow but I think I have not gotten the whole picture yet.

Something like: Do I need to do anything else before starting to use these tags? I tried using cfform cfinput and applied what these forum suggests and nothing work. For example, the autosuggest does not work.

I did my cfquery and then applied #ValueList(query.columnName)#, I got an error saying valuelist is not defined

Also,

I read about SPRY, do I need to download SPRY before I can work with ajax in ColdFusion 8?

Basically I just need some very basic gudance on how can I start. can anyone help???

This topic has been closed for replies.

1 reply

ilssac
Inspiring
November 10, 2010

You actually need NOTHING to do AJAX, not even the <cfwindow...> or <cfinput....> tags.

At it's most basic, all AJAX is is using the JavaScript XMLHttpRequest() function to make a request to a web server.  This request is just like any other request and the web server responds the same as any form submission, link or typed in URL request.

The only difference is on the client side instead of the browser building the entire web page, or a framed portion of it, the response is sent to a JavaScript function defined by the XMLHttpRequest() function.  This handler function then does what ever you want it to do with the data in the response.

It may be worth your time to make a simple, hand built AJAX request and response web page, just to know what the basics are.  The w3c schools XMLHttpRequest tutorial [http://www.w3schools.com/xml/xml_http.asp] is easy to follow and has ASP examples that are simple to convert into CFML.  I found this very helpful.

From there, you should then be able to make use of the ColdFusion built-in tags and wizards that just make it so much easier to deal with all the nitty-picky parts of the DOM, the JavaScript and the Server pieces that can be annoying to deal with for real world applications of AJAX.

Spry is another library to do the same thing, keep track of all the nitty-picky details.  So is the jQuery library (which does much more then just AJAX).

HTH

Ian

Message was edited by: ilssac  PS.  One thing I forgot I wanted to add.  For the ColdFusion AJAX (and other client side tools) to work properly.  Your web server MUST have a proper mapping to the scripts folder.  To test this, type this into your browser.  "http://www.yourdomain.com/cfide/scripts/wddx.js if that does not return a JavaScript file, your web server will not work with the ColdFusion built-in AJAX functionality.