Opened 13 years ago
Closed 13 years ago
#5640 closed feature (worksforme)
Docs for $.ajax should have an example for error handling
Reported by: | bjscott | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | docs | Version: | |
Keywords: | ajax, error, docs | Cc: | |
Blocked by: | Blocking: |
Description
It isn't obvious how to get the error text returned (either in the status or the response) in $.ajax's error handler if you're not already all over XmlHttpRequest. Something like this maybe:
$.ajax({
type: "POST", url: "delete.php", data: "id=INVALID", success: function(data){
alert("Success: " + data);
}, error: function(req, status, error) {
alert("Error (status): " + req.statusText); alert("Error (response): " + req.responseText);
}
});
Change History (1)
comment:1 Changed 13 years ago by
Milestone: | 1.4 |
---|---|
Resolution: | → worksforme |
Status: | new → closed |
Version: | 1.4a1 |
Note: See
TracTickets for help on using
tickets.