views:

57

answers:

1

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
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
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
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
It's not that tricky - do `var Data = jQuery('#FormId').serialize()` and then pass it into `jQuery('div').load(Target,Data,callbackFunction)`
Peter Boughton
PERFECT! That's it, Thanks Peter!
nullone
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