CFAjax ColdFusion Ajax Toolkit

CFAjax is an Ajax implementation for ColdFusion. It makes ColdFusion method calls on server directly from HTML page using JavaScript and return backs the result to the calling HTML page. CFAjax comes with simple to use JavaScript API and simple ColdFusion implementation that marshal’s the response between your CF methods and HTML page. Using CFAjax you can create highly interactive websites with greater performance and usability.
This one forwarded to me by Greg Ostravich, thanks.

16 responses to “CFAjax ColdFusion Ajax Toolkit”

  1. John Dowdell Avatar
    John Dowdell

    Thanks for picking this up, Ben. I had read the boilerplate at the site too, but didn’t download to learn what it actually did, and how. If there’s actually CF markup sent from the client engine, then this seems to imply that your server will process arbitrary CF from arbitrary IP addresses, which doesn’t seem safe. Have you seen fuller details on what they’re actually doing here…?

  2. N Rohler Avatar
    N Rohler

    I don’t think they’re calling CF directly, but rather executing CFC’s.

  3. jerry hamby Avatar
    jerry hamby

    I’m on a Mac and this works with FireFox but not with Safari. Not sure why.

  4. Ben Forta Avatar
    Ben Forta

    JD, the code is making HTTP calls to CFC methods (in much the same way as a SOAP or AMF request would be made), and then processes the results which are in a specified XML format. Actually, the flow is exactly how CFC methods are invoked via SOAP and AMF, with the exception being that ColdFusion has SOAP and AMF wrappers so that code can return any data (string, number, array, …) and the gateways on the server handle converting data as needed, whereas the CFC methods used with CFAjax have a very fixed output format that must be manually generated. And so yes, servers will process requests from arbitrary IP addresses (just as they typically would with SOAP and AMF requests). If you needed an authentication layer you could definitely build that, I don’t see why identifiers (like jsessionid or cfid/cftoken) could not be passed back in the request.

  5. Ben Forta Avatar
    Ben Forta

    JD, just to clarify, it is not passing CFML code to be processed, it is passing values to CFC methods (much like FORM and URL parameters do).

  6. Alan Quinlan Avatar
    Alan Quinlan

    This is very cool. I’ve recently started to play with DHTML scripts to give more options on pages without having to refresh. This is a nice next step.
    I’ve kind of taken the method of, if google can do it, why can’t i?

  7. John Dowdell Avatar
    John Dowdell

    Ah, cool, thanks… so they’re calling methods of encapsulated components specifically created for remote usage, instead of calling ColdFusion tags directly… that sounds safer than my initial takeaway on that text, thanks.
    And I guess the "*JaX" part is that they’re relying on each browser’s ability to request, parse and redisplay that XML-transferred data, instead of something like the HTML-replacement technique in Ruby On Rails… am I seeing the second part of this communication path correctly now?
    (Jerry, if you’re viewing a webpage which uses XmlHttpRequest in Safari, then you may need to upgrade your operating system to get a newer Safari… I’ve got a Jaguar Safari which silently fails on many of these "AJaX" pages too.)

  8. Ben Forta Avatar
    Ben Forta

    JD, correct. The calls to CFC methods return data, and JavaScript then updates the page to display that data as needed.

  9. Jerry Hamby Avatar
    Jerry Hamby

    I have the latest version of everything, so I can’t upgrade any further.
    Tiger 10.4.1
    Safari 2.0 (412)

  10. John Dowdell Avatar
    John Dowdell

    I think I’ll get a tattoo… "Every ‘AJaX’ demo really should have a support page"…. 😉

  11. Chuck Avatar

    Really neat, but not solid on all browsers…

  12. d!ck Avatar

    I’ve just posted a message on the Yahoo group that supports CFAJAX pointing out that there is a Apple page that explains how Safari can use XMLHttpRequest. It’s at…

  13. barry.b Avatar

    just a quick thought:
    we ditched the idea of calling CFC’s directly in our xmlhttprequest calls bacause we need to add session vars to the call for the cfc.
    sure we could create a facade CFC that breaks encapsulation and has session[""] references in it but it’s easier for us to have a dedicated cfm page called by the javascript that then calls the controller cfc’s for data.
    this is no big deal but I just wanted to throw this up as an alternative idea.
    my 2c

  14. jeff Avatar

    Do you need a certain version of CF Server to run cf pages with ajax? or does it not matter?

  15. Ben Forta Avatar
    Ben Forta

    Jeff, not really, no. If CFCs are used on the back end then you’d obviously need CFMX or later, but as far as being able to respond to requests, any version can do that.

  16. Bobby Amoroso Avatar
    Bobby Amoroso

    Ben and others,
    We are just beginning to look into AJAX and are having discussions about the pros and cons. When you get a chance, could you all take a look at some of these comment back to this post or to my email address ( Any insights you have would be greatly appreciated.

Leave a Reply