[jQuery] getting rid of my other AJAX library for jquery's...
I currently use another js library for AJAX purposes. Seeing as how jquery
has AJAX built in, I'd love to get rid of that other library. I was
wondering if someone could help me convert this code into the jquery way. I
need to pass in variables (not a problem) but I'd also like to be able to
perform additional actions other than just loading in the content into the
specified container.
Here's a perfect example:
function searchByKeyword() {
term = $('#searchfield').val();
param = 'term='+ term;
http( 'POST' , 'q.cfc?method=searchByKeyword' , searchResp , param );
}
function searchResp(obj) {
update('#title',obj.title)
update('#content',obj.content);
}
In this case, I call the searchByKeyword function. It loads the method
searchByKeyword off of q.cfc (a Coldfusion code library), passing in 'term'.
Then when the information has been returned, the searchResp callback
function is run, which performs two actions.
In the example page, I see the example of passing in parameters to the
dynamic page:
$("p").load("test.cgi",{
name: "John",
address: "123 Main St."
});
I also see an example of loading a callback function:
$("p").load("/test/ajax-test.html",function(){
$("p").show("fast");
});
Is it possible to combine those, passing in parameters AND running a
callback function? If so, what would that look like?
<!----------------//------
andy matthews
web developer
certified advanced coldfusion programmer
ICGLink, Inc.
andy@icglink.com
615.370.1530 x737
--------------//--------->
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/