ThePagan ThePagan - 5 months ago 22
jQuery Question

jQuery multiple Deferreds - how to process the rest if one is rejected

I have a

jquery statement which is waiting for 3 ajax requests to return before it carries out its next set of functions. The trouble I have is if one of these requests returns an error 500 then the system does not process to the next set of functions and the system gets frozen at this point.

Is there a way of getting the ajax call to step over the 500 error when in a $.when statement.

All ajax functions are defined outside of the $.when as separate functions and all of them have a success and error handling functions inside.

Here's a look at the code:

// functions that follow

so if any of the ajax calls fail then the done process is not complete. I thought even if the ajax call was to fail then it would still return the error handling.

The error 500 that is received is forced due to a permissions block from the API.


done is only called when the functions in when don't returns errors. Maybe you could use then instead of done and trigger the same function for both doneFilter and failFilter.