Added support for parsererror errors from Ajax requests (bug #1145).
This commit is contained in:
parent
3740716480
commit
e20e8e6e3c
1 changed files with 6 additions and 3 deletions
|
@ -662,7 +662,7 @@ jQuery.extend({
|
||||||
} else
|
} else
|
||||||
jQuery.handleError(s, xml, status);
|
jQuery.handleError(s, xml, status);
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
status = "error";
|
status = "parsererror";
|
||||||
jQuery.handleError(s, xml, status, e);
|
jQuery.handleError(s, xml, status, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -757,8 +757,11 @@ jQuery.extend({
|
||||||
*/
|
*/
|
||||||
httpData: function( r, type ) {
|
httpData: function( r, type ) {
|
||||||
var ct = r.getResponseHeader("content-type");
|
var ct = r.getResponseHeader("content-type");
|
||||||
var data = !type && ct && ct.indexOf("xml") >= 0;
|
var xml = type == "xml" || !type && ct && ct.indexOf("xml") >= 0;
|
||||||
data = type == "xml" || data ? r.responseXML : r.responseText;
|
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 the type is "script", eval it in global context
|
||||||
if ( type == "script" )
|
if ( type == "script" )
|
||||||
|
|
Loading…
Add table
Reference in a new issue