Fyi, I'm just starting to learn jQuery promises, so I may be a bit confused here.
Anyway, I have an AJAX request that I want to reject from within a done filter based on the content of the response:
return doAJAXRequest().then(function (data) {
if (data.responseText == "YES") {
return doOtherAJAXRequest();
} else {
this.reject(data);
}
});
That didn't work as I expected:
Uncaught TypeError: Object #<Object> has no method 'reject'
How do I make this promise fail based on its response? Is that possible? Or am I just confused about what needs to be done here?