jQuery deferred.fail() 方法

jQuery 教程 · 2019-03-29 19:38:03

实例

Deferred(延迟)对象被拒绝时调用deferred.fail()

$(function () { $.get("test.php") .done(function(){ alert("$.get 成功!"); }) .fail(function(){ alert("$.get 失败!"); }); })

定义和用法

deferred.fail() 函数当 Deferred (延迟)对象被拒绝时,调用添加的处理程序。
提示:该方法接受一个或者多个参数。 deferred.fail() 返回的是一个 Deferred 对象, 可以连接其他的延迟对象方法,包括额外的 .fail() 方法。当 Deferred 对象被拒绝时,回调函数 按它们被添加时的顺序执行,并且可以作为参数传递给如下的方法使用:deferred.resolve() 或 deferred.rejectWith()。

语法

deferred.fail( failCallbacks [, failCallbacks ] )

参数 描述
failCallbacks Function类型 一个函数或者函数数组,当Deferred(延迟)对象被拒绝时被调用
failCallbacks 可选。Function类型 一个函数或者函数数组,当Deferred(延迟)对象被拒绝时被调用

点击查看所有 jQuery 教程 文章: https://codercto.com/courses/l/35.html

查看所有标签

Graph Algorithms

Graph Algorithms

Shimon Even / Cambridge University Press / 2011-9-19 / USD 32.99

Shimon Even's Graph Algorithms, published in 1979, was a seminal introductory book on algorithms read by everyone engaged in the field. This thoroughly revised second edition, with a foreword by Richa......一起来看看 《Graph Algorithms》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具