I have a JavaScript class where pass options
object in init function.
this options
object also contains a callback
function
this callback function
is a globally defined function which create Ajax Request
and updates the contents.
After the contents are updated, I want to register some event on the controls returned by the Ajax
Is there a way that the Class method (which calls the callback function) waits util the contains are updated and then registers the events?
In order to do this, you have to pass another callback the first callback. Something like:
var feedDog = function(callback){
fedDog = true; //feed the dog
callback(function(){
alert("This will alert as a callback to feedDog's callback.");
});
};
feedDog(function(callback){
alert("Fed dog");
callback();
});