Check out a free preview of the full Learning jQuery course:
The "$.ajax Responses" Lesson is part of the full, Learning jQuery course featured in this preview video. Here's what you'd learn in this lesson:
Before jQuery 1.5, response handlers could were set as options (success, error, complete) Make sure to handle errors (think network outages) Now $.ajax returns a promise interface (jqXHR subset of xhr), a Deferred object. Read more about deferreds: http://api.jquery.com/category/deferred-object/ Instead of using options use done, fail and always methods. Using them you can add multiple handlers. If ajax has been completed they will fire method immediately (like document ready)