i have the following code
var a = ajax1();
var b = ajax2();
$.when(a,b).done(function(){
var d = function123();
$.when(d).done(function(){//doSomething});
});
function function123(){
var c = ajax3();
return c.promise();
}
return $.when(a,b,c).promise()//???;
How do i wait for everything to finish before returning the function?
edited: I have test the code using the following:
var e = $.when(a,b)
.done(function(){
var d = function123();
d.done(function(){
console.log('1');
});
return d.done(function(){//doSomething});
});
e.done(function(){
console.log('2');
});
my return result is '2 1'. however i am expecting a result of '1 2'. may i know why is that so?