JSMX hits the spot for simple AJAX applications
Monday, July 3rd, 2006
Finally, I ran across the need to try out AJAX. I had the simple requirement of updating a database without a full page refresh. I tried two different ColdFusion-friendly AJAX libraries: JSMX and ajaxCFC. One was the clear winner in terms of ease of use.
Technorati Tags:
web2.0, ajax, coldfusion, web 2.0, jsmx, ajaxcfc, javascript, web development
ajaxCFC proved to be troublesome for me. I fought it for two weeks, trying to rid of an error message indicating an invalid response from the server. I never did figure out why it didn’t work. Documentation is somewhat sparse. I’m sure there are some online support groups out there, but why should I have to look so hard?
JSMX was a lot simpler to use. It only contains one JavaScript file, engine.js, that you plop into your site’s file tree. So far, I’ve only really needed one function in order to get running, and it is pretty intuitive.
http("GET", "test.cfc?method=dosomething", my_callback, params);
That’s it. I got everything up and running in one evening, as opposed to fighting ajaxCFC for two weeks. No need to worry about your CFC extending anything. You return any needed data back to JavaScript using the <cfwddx> tag or a number of other XML methods. If you need to hook into a server side system other than ColdFusion, you are set to go without needing to find another AJAX library.
There are no real bells and whistles with JSMX, but I am sure the other more DHTML-heavy libraries out there could assist when needed. I’m looking forward to trying some of the others out, particularly Adobe’s Spry, when I am required to.



July 3rd, 2006 at 10:15 pm
JSMX is definitely simpler, but you are trading simplicity for robustness. I really do not want to get into details and jsmx, but as a simple concurrency test for example… try queuing many simultaneous requests and fake a 1-second response for each… Windows will only allow two simultaneous persistent requests and queue the remaining; if you run this with IE you will find the jsmx fires the queued requests in no particular order. This situation is not uncommon; a real application could easily have more than two simultaneous requests and your framework should be able to handle it effectively. Then again, if you write extremely simple Ajax apps, jsmx may be the one for you… one size doesn’t feat them all.
Cheers
~Rob
July 3rd, 2006 at 11:44 pm
Thanks for the comment, Rob. I’m not sure what the error was from your framework and why I was receiving it. But the application I have written will only be used by a couple users, and the business logic is in CFCs behind an Application.cfm that locks non-admin users out.
Maybe I will reevaluate when my requirements demand something more robust.
August 4th, 2006 at 2:13 pm
“if you write extremely simple Ajax apps, jsmx may be the one for you…one size doesn’t feat them all.” ?????
Please do not confuse simplicity with lack of power…. One could make the same argument about ColdFusion itself but you would be very much wrong there as well.
I have JSMX running on two enterprise level applications (one has been running almost 1 year) with no problems or shortcomings whatsoever. So the argument that JSMX is only adequate for simple Ajax apps is completely false.
As far as queued responses are concerned, if concurrency is an issue then Asynchronous requests are inappropriate regardless of what Ajax Stub you are using. Making that argument would be like faulting ColdFusion for not preserving order within structures (both go against “the nature of the beast”). Anchronous requests really SHOULDN’T matter which order they are fired off in since you cannot depend on which order the responses will be returned in. An attempt to control that would be a misuse of the very idea behind Asynchronous programming. So, this argument is invalid if trying to suggest JSMX is not robust.
I will say that JSMX was designed to be extremely easy to use and VERY flexible. I know of several PHP and .NET developers who use it as well. So I have no problems with anyone who prefers AjaxCFC over JSMX, that is fine. Just please don’t do JSMX a disservice by suggesting you con’t use it within “robust” application. JSMX can handle it