Bug Tracker

Ticket #6062 (closed bug: invalid)

Opened 4 years ago

Last modified 4 years ago

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

comment:1 Changed 4 years ago by snover

  • Priority set to undecided
  • Status changed from new to closed
  • Resolution set to invalid

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.

Note: See TracTickets for help on using tickets.