Ajax callbacks fire in wrong order
psuedo code:
when( x, y ).then(z)
where y is a call to a function that make an ajax call as in :
function y(......){
var p = $.ajax(...........);
p.done(callMeFirst);
return p;
}
now from my understanding on a successful ajax call 'callMeFirst' should fire first followed by 'z'
but what happens is that 'z' fires first and then 'callMeFIrst'
I don't get why that is happening or how to fix it as all our ajax calls run thru 'y' and its post call processing is needed before any other callback get to handle it.
TIA
Rob