If I understand you correctly, do you want to make the jqXHR action the way it happened when it really didn't work?
If so, .pipe is your friend :)
var jqDeferred = $.ajax(...something something); //make the deferred always resolve as success, calling all success callbacks on original. //AFAIK, dosent pass any arguments to the original success callbacks. jqDeferred.pipe( null, function(args){ return $.Deferred().resolve(); }); //same as above, but try to pass all arguments through to the success callbacks. jqDeferred.pipe( null, function(args){ return $.Deferred().resolve.apply(this, arguments); });
I wanted to do this recently and could not find any simple instructions, hope this helps. I'm not sure about passing the argument, because I used only the first form in anger - we don't need the arguments passed to our success callbacks.
The pipe is evil.
source share