I'm looking into using Jquery to replace some of our native Coldfusion ajax functionality. I really like the ability of Coldfusion AJAX to navigate simply and directly to any container (window, div,etc) and send along the content of any specified form data. Is there a JQuery way to do this?
+2
A:
http://api.jquery.com/load/ if you want basic loading of cfdiv
Submitting the form.... use a combo of ajax and manipulation functions
but if cfajax is working for you, why switch?
Henry
2010-07-31 02:23:58
We wish to "unwed" ourselves from the built-in Coldfusion functionality, which is OK for prototyping, and get to using jquery only with it's small file load size. yes, the jquery .load() command is trivial in that it can load any target id, but we need to pass along the form data as well. I do see a data option with this command but I'm not sure how to use it to post form data into the target id.
nullone
2010-07-31 03:19:28
You can't "post" to a DIV, but you can use JQuery to submit your form and then direct the return to that DIV.
jarofclay
2010-07-31 03:44:20
Right, that's how I am doing it now using Jquery. I think that is the way it's done. Not as easy as CF! Thanks
nullone
2010-07-31 04:35:27
It's not that tricky - do `var Data = jQuery('#FormId').serialize()` and then pass it into `jQuery('div').load(Target,Data,callbackFunction)`
Peter Boughton
2010-07-31 12:03:21
PERFECT! That's it, Thanks Peter!
nullone
2010-07-31 13:32:00
You can modify Peter's code a little if you want to use the POST instead of GET:var Data = jQuery('#FormId').serialize() and then pass it into jQuery('div').post(Target,Data,callbackFunction)See also: http://api.jquery.com/jQuery.post/
Daniel Sellers
2010-08-04 18:02:09