Hi,
you can also write
$.post('test.cgi', params, function(data) { myCallback(data,arg1,...);});
function myCallback()data, arg1,...){...}
if you need to pass arguments, other than data, to callback function
salvatore
----- Original Message -----
From: "james_027" <[EMAIL PROTECTED]>
To: "jQuery (English)" <jquery-en@googlegroups.com>
Sent: Thursday, July 12, 2007 3:40 AM
Subject: [jQuery] ajax api question
Hi,
I am using $.post() function, I don't understand what is callback
function ...
what is the difference between
$.post('test.cgi', params,
function(data) {
alert(data);
}
);
and
$.post('test.cgi', params, alert(data));
the data being shown is different. and I don't seem to understand what
is the difference in function(data) {alert(data);} from alert(data).
For me function(data) {alert(data);} is just a function taking the
data and just passing it to the alert(). Is function() inside the
$.post something special? where does the data come from? are the data
in the function(data) {alert(data);} and alert(data) different?
Thanks
james