Modify ↓
Ticket #6062 (closed bug: invalid)
Ajax call which retrieves a 301 status does not return this in the error callback
| Reported by: | daanoz | Owned by: | |
|---|---|---|---|
| Priority: | undecided | Milestone: | 1.4.2 |
| Component: | ajax | Version: | 1.4.1 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
$.ajax({
type: "POST", url: formpost.php, error: function(response, textStatus, errorThrown) {
alert(response.status);
}
});
if formpost.php has a redirect (301 header) on correct formsubmission, the ajax call, calls the error event. This is correct, but the status that is return is "0" instead of "301"
Change History
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
Note: See
TracTickets for help on using
tickets.

Thanks for the report, but this is not a bug. If status code is zero, that means you are trying to redirect to a location that violates the same-origin policy. XMLHttpRequest will always follow redirects and return the status code of the final page.