Commit 05a4b784 authored by Michael Geary's avatar Michael Geary

Fix jQuery.httpData to allow forcing of text data

parent 73f55bec
...@@ -174,11 +174,13 @@ jQuery.httpSuccess = function(r) { ...@@ -174,11 +174,13 @@ jQuery.httpSuccess = function(r) {
r.status == 304 ) || !r.status && location.protocol == "file:"; r.status == 304 ) || !r.status && 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,
// otherwise return plain text.
jQuery.httpData = function(r,type) { jQuery.httpData = function(r,type) {
// Check the headers, or watch for a force override var xml = ( !type || type == "xml" ) &&
return r.getResponseHeader("content-type").indexOf("xml") > 0 || r.getResponseHeader("content-type").indexOf("xml") >= 0;
type == "xml" ? r.responseXML : r.responseText; return xml ? r.responseXML : r.responseText;
}; };
// Serialize an array of form elements or a set of // Serialize an array of form elements or a set of
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment