Bug Tracker

Modify

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.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.