[jQuery] Jquery Ajax Post question
$.post("test.php", { func: "getNameAndTime" },
function(data){
process(data);
});
Is one of the examples given for Jquery.
Now I am trying to implement Jquery Ajax instead of a custom class we
have here so am trying to catch on so bear with me.
Above, it shows POST variable "func" containing "getNameAndTime" as a
value correct? So if I wanted to pass along say names I would pass
along {first: "Bob", last: "Smith"}?
I find adding the callback function right in the call a little awkward
(probably because I'm new to Jquery). Basically I was adding a onClick
function to a link to a function (function test()) and inside I was
going to add this jquery code. I just wanted to then have the returned
data at my disposal in a variable but it looks like I need to pass it
somewhere else?
I basically wanted to do this:
function disableTips ()
{
$.post("./test.php", {id : id_val}, function(data){
something here?
}
}) ;
then do something with data here
}
Am I going about it completely the wrong way with jquery?