-
February 11th, 2008jQuery 1.2.3 has been released. Just a couple of small bug fixes and new functions in this release – but most important of all, it’s now fully compatible with Adobe AIR.
Also released if v1.5a of jQuery UI, and the new jQuery enchant library (which deals primarily with effects).
For more information please visit the jQuery blog here.
Tags: jQuery -
February 5th, 2008There is now, available online, a connect recording of last week’s UKCFUG jQuery session that I did here.
For some reason, the sound hasn’t come out for first 35-odd minutes, and there is a couple of times where my connect client crashed causing me to drop out of the meeting (the demo gods were looking down on me).
UKCFUG – Introduction to jQuery
Tags: jQuery, presentations -
February 1st, 2008Yesterday, while presenting at the UKCFUG, a question was asked:
“How can I get ColdFusion to return me jSON encoded data, when I am still on version 7 and then use that data in jQuery?”
Well, I said I would blog the answer so it would be nice and clear, and this is that blog post.
In a nutshell, anything javascript loves jSON, the Javascript Object Notation (javascript speaking natively in simple terms). However, while in ColdFusion 8 you can easily get CFC’s to return jSON encoded data, ColdFusion 7 did not include this, so we need to get a little more imaginative. Whilst not impossible by any means, it is definitely a little more tricky than in CF, so use that if you can.
To start off with, you obviously need some sort of function to get you your data to return to jQuery. Something like this should do:
[viewcode] src=”2008/02/cf7_datasource.txt” geshi=cfm[/viewcode]
Now, thats a pretty simple function, nothing special at all. So how is this invoked? Well, one way of doing it is to create a gateway CFM file that calls your method and returns the result to the page (and this is by no means the only way). However, for this to render the data on the page it needs to convert it to something that takes the form of a string (jSON perhaps?). This is where you need to look at 3rd party code as there is no serializeJSON function in CF7.
Luckily, there is just such a bit of code, jSON.cfc . By using this we can convert pretty much anything into a jSON string for display. Like so:
[viewcode] src=”2008/02/cf7_datagateway.txt” geshi=cfm[/viewcode]
So, now we have a URL that gives me some jSON data. All that is left is to write the jQuery to get this data and handle it. Luckily for us, that’s real simple too:
[viewcode] src=”2008/02/cf7_jsonscript.txt” geshi=javascript[/viewcode]
Put all this together (with Firebug in Firefox) and you should see the variable you set in CF appearing in your browser.
Now as I said, there are other ways of doing this, so have a think about what you’re trying to do and you could probably find at least five other ways.
If you want to download jSON.cfc, it can be found here:
Tags: ColdFusion, jQuery

