Skip to content
Permalink
Browse files

Added support for parsererror errors from Ajax requests (bug #1145).

  • Loading branch information
jeresig committed Jul 21, 2007
1 parent 3740716 commit e20e8e6e3cc565469cedfad105565ce534c98c71
Showing with 6 additions and 3 deletions.
  1. +6 −3 src/ajax/ajax.js
@@ -662,7 +662,7 @@ jQuery.extend({
} else
jQuery.handleError(s, xml, status);
} catch(e) {
status = "error";
status = "parsererror";
jQuery.handleError(s, xml, status, e);
}

@@ -757,8 +757,11 @@ jQuery.extend({
*/
httpData: function( r, type ) {
var ct = r.getResponseHeader("content-type");
var data = !type && ct && ct.indexOf("xml") >= 0;
data = type == "xml" || data ? r.responseXML : r.responseText;
var xml = type == "xml" || !type && ct && ct.indexOf("xml") >= 0;
data = xml ? r.responseXML : r.responseText;

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

// If the type is "script", eval it in global context
if ( type == "script" )

0 comments on commit e20e8e6

Please sign in to comment.
You can’t perform that action at this time.