blog | bio | agenda | jobs | ajaxCFC

AjaxCFC for jQuery Alpha3 Release

I just updated the SVN with the 3rd alpha release of AjaxCFC for jQuery. For those of you not familiarized with source control repositories, I included the code into the main AjaxCFC download (thank Rey Bango for reminding me four times a day), available at RIAForge and my blog. You can also just click here.

This release includes several small fixes in the JavaScript and upgrade to the latest CFJSON. Thanks to Larry Reinhard for pointing it out.

The code seems to be really stable; I haven't got many bug reports, au contraire, Jacob Munson, from CFQuickDocs, said he dropped it into his code w/o any complications, maintaining all existing functionality.

I shall wrap up some documentation and officially release it for production.

Related Blog Entries

TrackBacks
There are no trackbacks for this entry.

Trackback URL for this entry:
http://www.robgonda.com/blog/trackback.cfm?B40A8488-3048-7431-E4CA4F565B067D6A

Comments
What can I say. I may be a pain but only because I'm one of the biggest fans of your work. :o)

Its good to have someone to push you every so often. ;o)
# Posted By Rey Bango | 2/11/07 11:43 PM
Your input is always welcomed.
# Posted By Rob Gonda | 2/12/07 12:01 AM
Thank you!! I love ajaxCFC so thank you very much for all of your great work!
# Posted By John Wilson | 2/12/07 1:32 PM
JSON appears to still be broken in this release :/ I get "a critical error" when trying to return the same query with json serialization as opposed to wddx. The data packet is there (it comes up in the popup window ajaxcfc launches), and it looks valid so I'm not sure where it's blowing up.
# Posted By John Wilson | 2/12/07 2:15 PM
John, give us a test link to see whats happening.
# Posted By Rey Bango | 2/12/07 2:23 PM
I apologize - I was getting what looked like the same error in Alpha2 that the cfjson update fixed in Alpha3. After digging deeper I found it was an error on my part. At the moment if you get an error in javascript the debug window dumps the recordset which is misleading - I expect to see server errors/info there.

It seems to be working correctly. Sorry for the false start :/

What an outstanding tool - thanks again for providing this.
# Posted By John Wilson | 2/12/07 3:30 PM
By the way, cfjson returns a very large amount of whitespace when deserializing. If you could add output="no" to the cfcomponent and cffunction tags in the version included with ajaxcfc it would be most helpful.
# Posted By John Wilson | 2/12/07 3:39 PM
Good point; thanks Dan. I have output=false in the Alpha2 version, but when I upgraded I left it out. It's already in the repo.
When you say 'get an error in JavaScript'.. you mean after the Ajax call? in your callback handler? The log4javascript window only logs Ajax traffic, and does not trap your client side errors... it is not a bad idea to create an window.onError function and bind it, but it was not the original idea. The reason why you see the recordset if because the Ajax call completed successfully.

I see your point though; I'll see if I can add a log of the JS error... I would need to rethrow the error for you to be able to trap it using your consoles, profilers, debugging tools...
# Posted By Rob Gonda | 2/12/07 9:04 PM
I'm a bit confused as to what is being used, and for what exactly: jquery, dwr, and your cfc?

if so, why do we need dwr and jquery? Why not just jquery alone with your cfc? And how much does all that clientside js weigh?

Or is the dwr stuff all serverside?

Thanks.
# Posted By ziggy | 2/13/07 1:43 AM
I the above comment answered anywhere on your site or the cfc site? Thanks.
# Posted By ziggy | 2/15/07 4:06 AM
Rob/All,

Periodically, and only in firefox, ajaxCFC calls will fail to get any response from the server. This can be immediately fixed by clearing all private data (cache, cookies, etc), and then it works perfectly.

Any idea why this is happening, and is there a way to prevent it on the server side?
# Posted By Jeff Gladnick | 2/21/07 2:14 PM
How did you fix "a critical error occured" - the data packet is returned with a critical error message and then opens in a new window. I downloaded the latest json.cfc but doesn't seem to help.

Thanks.
# Posted By Mitch Rubin | 3/16/07 3:13 PM
Since I'm obviously the second one to get tripped up on this I figured I'd post how I resolved it to make it easier on the next person. If you are using prototype sytnax you'll have to change it to jquery sytax. For example:

$('completedtab').style.display = "none"; //prototype
$('completedtab').innerHTML = r; // prototype
must be changed to this:
$('#completedtab').css("display","none"); //jquery
$('#completedtab').text(r); //jquery

I assumed incorrectly that the error was buried deep in the AjaxCFC Jquery framework; it's not. Any javascript error will be displayed in a popup window.

Since we are standardizing on jquery this is an important release for us. Thanks to all involved.
# Posted By Mitch Rubin | 3/17/07 12:08 PM
@Mitch: good post, thanks. The $() shortcut is indeed used differently across the different libraries. For DWR and Prototype, it is nothing but a shortcut for getElementById, whereas for jQuery, it is a shortcut for the jQuery namespace, where it's most common use is a CSS3 Selector.
# Posted By Rob Gonda | 3/26/07 8:15 AM
I can't seem to get debugging turned off (at least the helper window keeps pooping up)...

Out of all this, what can I remove for production?

<script type="text/javascript">
   // additional files
   $.AjaxCFC({require:'json'});
   // more additional files
   //
$.AjaxCFC({require:'json,wddx,dDumper,log4j,DWRSyntax,blockUI'});
   // optional global settings
   // using these setters also automatically include dependencies
   $.AjaxCFCHelper.setDebug(false);
   $.AjaxCFCHelper.setBlockUI(false);
   $.AjaxCFCHelper.setUseDefaultErrorHandler(false);
   $.AjaxCFCHelper.setSerialization('json'); // json, wddx
   $.taconite.debug = false;
   $.taconite.enableAutoDetection(false);
</script>

btw - I'm loving this whole Ajax process thanks to you... smooth, clean, simple, THANKS!

- Thomas
# Posted By Thomas Dehli | 3/26/07 9:58 PM
I was thinking we should avoid the "jQuery Shortcut" since it may conflict with other libraries. jQuery supports a function to shut that off and we should see the JS code addressing the jQuery namespace rather than the shortcut.

How close are we to "gold"?
# Posted By John Farrar | 4/9/07 12:45 PM
Help, I get an "unterminated string constant" error in IE6 when using wddx serialization. I tried grabbing the latest Alpha but it's still not working. Seems to work ok in Firefox, although one of my coworkers is having problems with a fatal error on Firefox as well - they may be on an older version of Firefox. Any help is appreciated.
# Posted By Josh Nathanson | 4/20/07 6:06 PM
OK, well I switched to json and figured out how to access the data that comes back. So it's working. I had to dig around to figure it out though, it wasn't till I checked the blog post for Alpha 2 that I realized what the issue was - when you're returning a query from your cfc, you have to use r.data.column_name[row] rather than r.column_name[row]. Dummies like me need that explicitly spelled out somewhere!

So I guess there's no good reason to use wddx now, since json is quicker?

Thanks for the awesome tool Rob!
# Posted By Josh Nathanson | 4/20/07 6:57 PM
Josh, CF encodes quicker using wddx than json, however, a wddx string is longer and it takes longer to decode in the JS side. CF8 will include native json encoding, thus it will improve CF's performance there. Overall, I tend to use json more than wddx.
HTH
# Posted By Rob Gonda | 4/22/07 10:37 PM
John, you're right... the $() functions tends to confuse people, especially because it means different things with different libraries. You can use the full jQuery namespace, though I love the $() convenience.
# Posted By Rob Gonda | 4/22/07 10:39 PM
I was having a heck of a time getting this to work with json input and getting back a struct in a simple echo-esque demo.

It turns out that there was a problem in json.cfc. The version in the AjaxCFC jquery branch in the riaforge repo is 1.6b, I replaced that with 1.7 from http://www.epiphantastic.com/cfjson/

That seems to have fixed it. Hope this helps someone else.

Jeffrey
# Posted By Jeff Borisch | 5/11/07 5:04 PM
@Jeff, Thanks! Just updated the SVN repo and the download zip
# Posted By Rob Gonda | 5/15/07 12:25 AM
This is a great tool...if I can get it working. I'm trying to integrate the newest alpha release into a Mach-II installation to no avail. Has anyone had success with it?

I know that there is a contactManager sample app of a previous version that was Mach-II integrated but these alphas seem to have some significant differences from that old version. Thanks in advance.
# Posted By Gene | 2/26/08 1:35 AM
So it seems like I'm the only Mach-II developer left in this world with the desire to get ajaxCFC alpha 3 working in a Mach-II way. So after much repair work, as well as a healthy amount of poking and prodding, I've made the necessary changes to ajaxCFC and now have a working (Mach-II 1.5 + ajaxCFC 1.1 a3). If you need assistance in getting this working for you, please let me know by posting on this page (some contact info could be helpful too).
# Posted By Gene | 2/27/08 2:51 PM
Gene, could you send me the updated code so I include it with the distribution?

Thanks
# Posted By Rob Gonda | 3/7/08 5:18 PM
BlogCFC was created by Raymond Camden. This blog is running version 5.1.004.