最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - What are the parameters sent to .always in jQuery? - Stack Overflow

programmeradmin0浏览0评论

I can't find the documentation on what are the parameters for the always() method.

Right now, I'm just using:

$.post("foo.do", {
    ...
}, function(data) {
    ...
}).fail(function(jqXHR, textStatus, errorThrown) {
    ...
}).always(function() {
    ...
});

I can't find the documentation on what are the parameters for the always() method.

Right now, I'm just using:

$.post("foo.do", {
    ...
}, function(data) {
    ...
}).fail(function(jqXHR, textStatus, errorThrown) {
    ...
}).always(function() {
    ...
});
Share Improve this question edited Oct 11, 2014 at 19:15 Mike 24.5k14 gold badges83 silver badges93 bronze badges asked Oct 11, 2014 at 18:59 Paul VargasPaul Vargas 42.1k16 gold badges107 silver badges148 bronze badges 1
  • See also api.jquery./jquery.ajax jqXHR.always(function( data|jqXHR, textStatus, jqXHR|errorThrown ) { }); – Mike Commented Oct 11, 2014 at 19:01
Add a ment  | 

1 Answer 1

Reset to default 7

The documentation is in jqXHR section of the $.ajax entry. 1

The parameters are as follows:

jqXHR.always(function( data|jqXHR, textStatus, jqXHR|errorThrown ) { });

  • If an error occurred:

    jqXHR.always(function( jqXHR, textStatus, errorThrown ) { });
    
  • And otherwise:

    jqXHR.always(function( data, textStatus, jqXHR ) { });
    

Notes

  1. Thanks to Mike's ment.
发布评论

评论列表(0)

  1. 暂无评论