0

I need to do something when an ajax request is completed, irrespective of it's failure or success. I am using jQuery deferred objects "always" method for this.

My question is inside "always" method how do I determine if it's called because service request failed or succeeded

4

1 回答 1

0

完全的

Type: Function( jqXHR jqXHR, String textStatus )

请求完成时要调用的函数(在执行成功错误回调之后)。该函数传递了两个参数:jqXHR(在 jQuery 1.4.x 中,XMLHTTPRequest)对象和一个对请求状态进行分类的字符串("success""notmodified""error""timeout""abort"“解析器错误”)。从 jQuery 1.5 开始完整的设置可以接受一个函数数组。每个函数都会被依次调用。

参考:jQuery.ajax()

于 2013-07-12T18:02:39.733 回答