Thursday, December 15th, 2005

Cold Fusion + Prototype Ajax presentation and example code

Category: Examples, Prototype

Pete Freitag has posted the outline and an example from an Ajax presentation he gave at a Cold Fusion users group. The example is the standard zip code lookup with Cold Fusion on the server and Prototype for the client side. Prototype makes the error handling and form handling easy, as you can see from the example code:

function checkZip() {
  if($F('zip').length == 5) {
     var url = 'checkZip.cfm';
     var params = 'zip=' + $F('zip');
     var ajax = new Ajax.Updater(
       {success: 'zipResult'}, url, 
       {method: 'get', parameters: params, onFailure: reportError});}

function reportError(request) {
  $F('zipResult') = "Error";

Peter also linked to a source for the free MySql zip code database, might be useful for others doing the proof of concept thing.


Posted by Rob Sanheim at 9:29 am
1 Comment

3.6 rating from 8 votes

1 Comment »

Comments feed

I’ve personally never used the updater … I prefer doing this function manually and use a simple DOM call to replace the content of the Div in this case.

How many of you like the updater function? Depending on this thread, I’ll add that functionality to ajaxCFC (


Comment by Rob Gonda — December 15, 2005

Leave a comment

You must be logged in to post a comment.