Skip to main content

Bug Tracker

Side navigation

#1541 closed bug (wontfix)

Opened August 27, 2007 03:44AM UTC

Closed September 15, 2007 02:47AM UTC

[PATCH] Ajax request with dataType 'xml' raises parsererror on HTTP HEAD response

Reported by: gbuesing Owned by:
Priority: major Milestone: 1.2.1
Component: ajax Version: 1.2
Keywords: ajax xml Cc:
Blocked by: Blocking:
Description

The 1.1.4 release adds the following check on the xmlHttpRequest object when dataType is 'xml':

if ( xml && data.documentElement.tagName == "parsererror" )
  throw "parsererror";

This raises an error when malformed xml is sent to the browser, which is desirable behavior, but it also raises an error when the server responds with an HTTP HEAD response (which has a blank body) to indicate success.

This change therefore breaks compatibility with existing apis that use HTTP HEAD responses to indicate success.

I've added logic so that a blank response body can pass through successfully:

if ( xml && r.responseText.match(/\\S/) && data.documentElement.tagName == "parsererror" )
  throw "parsererror";
Attachments (1)
Change History (1)

Changed September 15, 2007 02:47AM UTC by john comment:1

milestone: 1.21.2.1
resolution: → wontfix
status: newclosed
version: 1.1.41.2

That's correct - if there's no response from the server, then there's no way that an XML document can be built - thus throwing an error.

See this thread for more details:

http://groups.google.com/group/jquery-dev/browse_frm/thread/ba67ecdec0059cc0/eb87e5bf1f7b989d