Skip to content
Permalink
Browse files

Fix jQuery.httpData to allow forcing of text data

  • Loading branch information
Michael Geary
Michael Geary committed Jul 2, 2006
1 parent 73f55be commit 05a4b784e892ea0dd56201fa1b7a77c7a453bfa7
Showing with 6 additions and 4 deletions.
  1. +6 −4 ajax/ajax.js
@@ -174,11 +174,13 @@ jQuery.httpSuccess = function(r) {
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) {
// Check the headers, or watch for a force override
return r.getResponseHeader("content-type").indexOf("xml") > 0 ||
type == "xml" ? r.responseXML : r.responseText;
var xml = ( !type || type == "xml" ) &&
r.getResponseHeader("content-type").indexOf("xml") >= 0;
return xml ? r.responseXML : r.responseText;
};

// Serialize an array of form elements or a set of

0 comments on commit 05a4b78

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