jQuery deferred.fail () method
Examples
When the call is rejected deferred.fail Deferred (delay) Object ()
$ (Function () {$. Get ( "test.php" ). Done (function () { alert ( "$ .get success!");}) fail ( function () {. alert ( "$ .get failed!");});})
try it"
Definition and Usage
deferred.fail () function when when the Deferred (delay) the object is rejected, add a call handler.
Tip: This method takes one or more parameters. deferred.fail () returns a Deferred object, you can connect other lingering objects, comprising an additional .fail () method. When the Deferred object is rejected, the callback function in the order they are added to the execution, and can be passed as parameters to the following method: deferred.resolve () or deferred.rejectWith ().
grammar
deferred.fail( failCallbacks [, failCallbacks ] )
参数 | 描述 |
---|---|
failCallbacks | Function类型 一个函数或者函数数组,当Deferred(延迟)对象被拒绝时被调用 |
failCallbacks | 可选。Function类型 一个函数或者函数数组,当Deferred(延迟)对象被拒绝时被调用 |