I have a test_func that needs to be executed sequentially, ie; first_call, second_call, third_call.
Current output:-
started == first_call
VM81:49 status in : first_call pending
VM81:47 started == second_Call
VM81:47 started == third_Call
VM81:49 status in : second_Call pending
VM81:49 status in : third_Call pending
function test_func(call_from){
var deferred = $.Deferred();
console.log('started ==',call_from)
setTimeout(function(){
console.log("status in :",call_from + ' ' + deferred.state());
deferred.resolve();
},5000);
return deferred.promise();
};
test_func('first_call').then(function(){
test_func('second_Call')
}).then(function(){
test_func('third_Call')
})