score:0

you need to make deferred jquery function calls something like this:

function test(){
          var defer = $.deferred();
          settimeout(function(){console.log("prints 1st");defer.resolve();},1000);
          return defer;
 }
function test2(){
       console.log("prints 2nd");
      return $.when();
 }
test().then(test2).then(function () {
           console.log("prints at the end.");    
 });

here is a working example http://jsbin.com/payitucami/edit?html,console


Related Query

More Query from same tag