Here is an over view of my js file where I am calling 2 function foo1 and foo2.
function foo1(){
// do some ajax call which takes random amount of time
}
function foo2(){
// do something which needs foo1() being already done
}
foo1();
// reach here only if foo1 is complete
foo2();
ps. I dont want to use jQuery or knockout. Also have already looked into How to wait for a func...