从jQuery 1.5开始,所有jQuery的Ajax方法都返回一个jqXHR
对象,提供.error()
、.success()
和.complete()
个方法.
.success()
和.complete()
之间有什么区别?
从jQuery 1.5开始,所有jQuery的Ajax方法都返回一个jqXHR
对象,提供.error()
、.success()
和.complete()
个方法.
.success()
和.complete()
之间有什么区别?
.success()
only gets called if your webserver responds with a 200 OK
HTTP header - basically when everything is fine.
However, .complete()
will always get called no matter if the ajax call was successful or not - maybe it outputted errors and returned an error - .complete() will still get called.
值得一提的是,.complete()
会被称为after,.success()
会被称为.success()
-如果这对你很重要.