Delayed object-deferred.fail(failCallbacks[,failCallbacks])

Delayed object-deferred.fail(failCallbacks[,failCallbacks]), someone asked me to explain?


Call a function or array function when the delay fails.

This parameter can be a function or an array of functions. When the delay fails, doneCallbacks is called. The callback execution is in the order they were added. Once deferred.fail() returns a lingering object, other methods of templating the object can also be linked here, including adding the .done() method. When the delay is resolved, the doneCallbacks execution is called with the parameters supplied to the resolve or resolveWith methods in the order they were added. For more information, see Deferred object .



a function or array function that is called when the delay fails


Additional optional function or array function, called when the delay fails



Once the jQuery.get method returns a jqXHR object, this is derived from a deferred, and the success and failure callbacks can be attached using the deferrred.done() and deferred.fail() methods.

jQuery code:
   .done(function () {
       alert("$.get succeeded");
   .fail(function () {
       alert("$.get failed!");



Post your comments / questions