I have the following code:
myFunc();
bar();
myFunc() is making an ajax request
I don't want to execute bar() until myFunc()'s request has completed.
I also do not want to move the call to bar() inside of myFunc.
possible?
EDIT
Here is the code I ended up with:
var FOO = {
init: function(blah)
{
// Callbacks to pass to the AJAX challenge data load
var callbacks = {
myFunc1: function(){ myFunc1(blah); },
myFunc2: function(){ myFunc2(blah); },
};
this.bar(callbacks); // Load the challenge data and setup the game
},
bar: function(callbacks) { ..loop through and execute them.. }
};