I am calling two functions in $.when(f1,f2) but done() is called before f2 is resolved. But if I put alert() statement in done It is working fine.
function f1(){
var d= new $.Deferred();
.......code......
d.resolve();
return d.promise();
}
function f2(){
var d= new $.Deferred();
.......code......
d.resolve();
return d.promise();
}
function f3()
{.....code..... }
$.when(f1().f2()).done(f3());
above code is calling f3 even before f2() is resolved. But if I put alert statement in done() It is working fine.
$.when(f1().f2()).done( alert ("came here");f3());
this is executing in proper sequence.
same is with $.when(f1,f2).then() also. could anybody please tell me what could be the reason for this unusual behaviour.