deferred.catch()

deferred.catch()

deferred.catch( failFilter )Returns: Promise

Description: Add handlers to be called when the Deferred object is rejected.

deferred.catch( fn ) is an alias to deferred.then( null, fn ). Read its page for more information.

Example:

Since the jQuery.get method returns a jqXHR object, which is derived from a Deferred object, we can rejection handlers using the .catch method.

$.get( "test.php" )
  .then( function() {
    alert( "$.get succeeded" );
  } )
  .catch( function() {
    alert( "$.get failed!" );
  } );

© The jQuery Foundation and other contributors
Licensed under the MIT License.
https://api.jquery.com/deferred.catch

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部