I\'m new to ajax and callback functions, please forgive me if i get the concepts all wrong.
Problem: Could i send a callbackfunction
Yes of course, function are objects and can be passed, but of course you must declare it:
function firstFunction(){
//some code
var callbackfunction = function(data){
//do something with the data returned from the ajax request
}
//a callback function is written for $.post() to execute
secondFunction("var1","var2",callbackfunction);
}
an interesting thing is that your callback function has also access to every variable you might have declared inside firstFunction() (variables in javascript have local scope).