Skip to main content

Bug Tracker

Side navigation

#5640 closed feature (worksforme)

Opened December 11, 2009 12:07PM UTC

Closed February 05, 2010 08:04PM UTC

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);

}

});

Attachments (0)
Change History (1)

Changed February 05, 2010 08:04PM UTC by john comment:1

milestone: 1.4
resolution: → worksforme
status: newclosed
version: 1.4a1