我是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);
}