我是 ajax 和回调函数的新手,如果我把概念弄错了,请原谅我。
问题:我可以将回调函数作为参数发送给另一个将执行回调的函数吗?
function firstFunction(){
//some code
//a callback function is written for $.post() to execute
secondFunction("var1","var2",callbackfunction);
}
function secondFunction(var1, var2, callbackfunction) {
params={}
if (event != null) params = event + '&' + $(form).serialize();
// $.post() will execute the callback function
$.post(form.action,params, callbackfunction);
}