control-freak-ide/Control-Freak-Documentation/jQuery/docs/entries/deferred.fail.json
plastic-hub-dev-node-saturn 538369cff7 latest
2021-05-12 18:35:18 +02:00

1 line
1.9 KiB
JSON

{"name":"deferred.fail","type":"method","title":"deferred.fail()","deprecated":null,"removed":null,"desc":" Add handlers to be called when the Deferred object is rejected. ","categories":["deferred-object","version/1.5"],"entries":[{"return":"Deferred","signatures":{"added":"1.5","argument":[{"desc":"\n A function, or array of functions, that are called when the Deferred is rejected.\n ","name":"failCallbacks","type":"Function"},{"desc":"\n Optional additional functions, or arrays of functions, that are called when the Deferred is rejected.\n ","name":"failCallbacks","type":"Function","optional":"true"}]},"examples":{"desc":"Since the <ahref=\"/jQuery.get/\"><code>jQuery.get</code></a> method returns a jqXHR object, which is derived from a Deferred, you can attach a success and failure callback using the <code>deferred.done()</code> and <code>deferred.fail()</code> methods.","code":"\n$.get( \"test.php\" )\n .done(function() {\n alert( \"$.get succeeded\" );\n })\n .fail(function() {\n alert( \"$.get failed!\" );\n });\n"},"longdesc":"\n <p>The <code>deferred.fail()</code> method accepts one or more arguments, all of which can be either a single function or an array of functions. When the Deferred is rejected, the failCallbacks are called. Callbacks are executed in the order they were added. Since <code>deferred.fail()</code> returns the deferred object, other methods of the deferred object can be chained to this one, including additional <code>deferred.fail()</code> methods. The failCallbacks are executed using the arguments provided to the <a href=\"/deferred.reject/\"><code>deferred.reject()</code></a> or <a href=\"/deferred.rejectWith/\"><code>deferred.rejectWith()</code></a> method call in the order they were added. For more information, see the documentation for <a href=\"/category/deferred-object/\">Deferred object</a>.</p>\n "}]}