Bug Tracker

Modify

Ticket #12011 (closed bug: invalid)

Opened 11 months ago

Last modified 10 months ago

HEAD only response caused JQUERY parser fail

Reported by: hayafirst@… Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.7.2
Keywords: Cc:
Blocking: Blocked by:

Description

When I return a HEAD 200 to a Jquery ajax call. I got: JSON Parse error: Unexpected EOF. The whole error looks like this:

http://i.imgur.com/xTYaT.png

pass back an empty JSON then it is OK

my ajax call looks like this:

$(function(){
  $("#login-form").submit(function(){
    var form_values = $(this).serializeArray();
    $.ajax({
      url: "/login.json",
      type: "post",
      data: form_values,
      success: function(){
        window.location.href = "/";
      },

      error: function(jqXHR, textStatus, errorThrown){
        console.log(textStatus);
        console.log(jqXHR);
        console.log(errorThrown);
      }
    }
    );
    return false;
  })
}
);

Change History

comment:1 Changed 10 months ago by dmethvin

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

Yeah, don't pass back nothing if the request is expecting something.

comment:2 Changed 10 months ago by anonymous

The point is the request is not really expecting something. The user script can handle empty json case, just query can't.

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.