Handling jQuery AJAX Responses

$.get("getUser.php?first=Brad&last=Dayley", null, function (data, status, xObj){   alert("Request Succeeded"); }), "json").fail(function(data, status, xObj){   alert("Request Failed"); }).always(function(data, status, xObj){   alert("Request Finished"); });

In addition to specifying the success option, the wrapper methods also allow you to attach additional handlers using the following methods:

Image .done(data, textStatus, jqXHR)—Called when a successful response is received from the server.

.fail(data, textStatus, jqXHR)—Called when a failure response is received from the server or ...

Get jQuery and JavaScript Phrasebook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.