Added in a couple AJAX fixes for status and content-type.
This commit is contained in:
parent
abf3054667
commit
1edf3a2be9
|
@ -170,16 +170,17 @@ jQuery.ajax.active = 0;
|
||||||
|
|
||||||
// Determines if an XMLHttpRequest was successful or not
|
// Determines if an XMLHttpRequest was successful or not
|
||||||
jQuery.httpSuccess = function(r) {
|
jQuery.httpSuccess = function(r) {
|
||||||
return ( r.status && ( r.status >= 200 && r.status < 300 ) ||
|
return r.status ?
|
||||||
r.status == 304 ) || !r.status && location.protocol == "file:";
|
( r.status >= 200 && r.status < 300 ) || r.status == 304 :
|
||||||
|
location.protocol == "file:";
|
||||||
};
|
};
|
||||||
|
|
||||||
// Get the data out of an XMLHttpRequest.
|
// Get the data out of an XMLHttpRequest.
|
||||||
// Return parsed XML if content-type header is "xml" and type is "xml" or omitted,
|
// Return parsed XML if content-type header is "xml" and type is "xml" or omitted,
|
||||||
// otherwise return plain text.
|
// otherwise return plain text.
|
||||||
jQuery.httpData = function(r,type) {
|
jQuery.httpData = function(r,type) {
|
||||||
var xml = ( !type || type == "xml" ) &&
|
var ct = r.getResponseHeader("content-type");
|
||||||
r.getResponseHeader("content-type").indexOf("xml") >= 0;
|
var xml = ( !type || type == "xml" ) && ct && ct.indexOf("xml") >= 0;
|
||||||
return xml ? r.responseXML : r.responseText;
|
return xml ? r.responseXML : r.responseText;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue