JSMX, AJAX and ColdFusion API implementation
Todd Kingham pointed me today to JSMX, a ColdFusion AJAX API. Certainly we didn't talked about ColdFusion before on the AJAX Magazine, but there is a couple of interesting implementations out there. JSMX is a very simple API to implement AJAX in your ColdFusion web application, it consist on a single Javascript file using XMLHttpRequest to post/get data from a ColdFusion interface.

JSMX is the simplest API available for connecting your Web Applications to an AJAX front end. The main difference between JSMX and other AJAX implementations is that JSMX allows you to pass either XML or JavaScript to the API. JSMX was originally created to be used with ColdFusion applications because of how easy it is to create JavaScript Strings natively within ColdFusion (using either the CFWDDX tag or the ToScript() function). However, because there is no server-side component to be installed, JSMX can really be used with any programming language.
You can find many good examples provided at the website in addition to an AJAX Chat application similar to Google Talk for Gmail, when loggued in the messenger it load list of contacts and you can message the online users. I liked the feature telling that your friend is typing a message, but I find it a little slow as we were already talking about lacency recently.
Usage of JSMX is all around the http() function where you can pass parameters to server using three different formats :
As a QueryString Delimited List
function my_request(){
params = "attribute1=value1&attribute2=value2";
http( "POST" , "test.cfc?method=dosomething" , my_callback , params );
}
As a JavaScript Object()
function my_request(){
params = new Object();
params.attribute1 = "value1";
params.attribute2 = "value2";
http( "POST" , "test.cfc?method=dosomething" , my_callback , params );
}
As an HTML Form
function my_request(){
params = document.myForm;
http( "POST" , "test.cfc?method=dosomething" , my_callback , params );
}
JSMX is released under a Creative commons license and the latest version is 2.4 which allowed passing XML Documents to the API in addition to the original JavaScript method.


Subscribe to AJAX Magazine's feed