-
Notifications
You must be signed in to change notification settings - Fork 265
/
Copy pathdeferred.catch.xml
31 lines (30 loc) · 1.13 KB
/
deferred.catch.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?xml version="1.0"?>
<entry name="deferred.catch" type="method" return="Promise">
<title>deferred.catch()</title>
<signature>
<added>3.0</added>
<argument name="failFilter" type="Function">
<desc>
A function that is called when the Deferred is rejected.
</desc>
</argument>
</signature>
<desc>Add handlers to be called when the Deferred object is rejected. </desc>
<longdesc>
<p><code>deferred.catch( fn )</code> is an alias to <a href="/deferred.then/"><code>deferred.then( null, fn )</code></a>. Read its page for more information.</p>
</longdesc>
<example>
<desc>Since the <a href="/jQuery.get/"><code>jQuery.get</code></a> method returns a jqXHR object, which is derived from a Deferred object, we can add rejection handlers using the <code>.catch</code> method.</desc>
<code><![CDATA[
$.get( "test.php" )
.then( function() {
alert( "$.get succeeded" );
} )
.catch( function() {
alert( "$.get failed!" );
} );
]]></code>
</example>
<category slug="deferred-object"/>
<category slug="version/3.0"/>
</entry>