I am sending multiple promise to get user details using ajax.
var a= APP.request('user:getID');//Promise request
var b= APP.request('user:getName');//Promise request
var c= APP.request('user:getNumber');//Promise request
var d= APP.request('user:getAge');//Promise request
$.when(a.done(), b.done(), c.done(), d.done()).done(function() {
console.log("Saving to single view.");//Working fine when ajax url is up.not working if any one url goes down.
}
This will work if all the url's are up. But if any one url is down it will not enter inside when block.
I just modified the code and introduced then, still same problem.
$.when(a.then(), b.then(), c.then(), d.then()).then(function() {
console.log("Saving to single view.");
}
I am not able to get what's wrong with my code.
Update: i have to execute $when block only after all the promises are being executed.