[jQuery] getting rid of my other AJAX library for jquery's...
I just tested this and the thing that appears to be holding me up is that
the value returned by the dynamic page goes straight into the object
specified in the $() method.
What if you need to update two things on a page with the information
returned? To clarify, I need the following:
- a dynamic page call (done)
- passing in parameters (done)
- a callback function (done)
- a return "variable" containing the parsed contents of the called page (not
sure about)
If I need to keep using my other library, then it's no big deal. I just like
the idea of using just jquery and I'm sure it's got to be capable of doing
this. It's probably just my limitation.
<!----------------//------
andy matthews
web developer
certified advanced coldfusion programmer
ICGLink, Inc.
andy@icglink.com
615.370.1530 x737
--------------//--------->
-----Original Message-----
From: discuss-bounces@jquery.com [mailto:discuss-bounces@jquery.com]On
Behalf Of Andy Matthews
Sent: Friday, July 07, 2006 9:50 AM
To: [jQuery]
Subject: [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/
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/