I have three functions. One of them is an AJAX call, one is the callback function provided to this AJAX function, and the last is a completely independent function, waiting for the completion of the AJAX functions. The third function must remain completely independent of the AJAX function; it cannot be passed as a parameter to the AJAX function. My code is:
doAjaxStuff: function(callbackFunction){
$.ajax(
callbackFunction();
)
}
callMeMaybe: function(data){
}
patientFunction: function(){
$.when(this.doAjaxStuff).done(function(){
alert("doAjaxStuff() has finished!");
});
}
But I never get a message when a message appears. The AJAX call and callback function succeeds, but the $ .when () function never starts. What happens in this code?
source
share