As of jQuery 1.5, all jQuery's AJAX methods return a jqXHR object that provides .error(), .success(), and .complete() methods.
jqXHR
.error()
.success()
.complete()
What is the difference between .success() and .complete()?
.success() only gets called if your webserver responds with a 200 OK HTTP header - basically when everything is fine.
200 OK
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.
It's worth mentioning that .complete() will get called after .success() gets called - if it matters to you.
1.4m articles
1.4m replys
5 comments
56.9k users