Created
November 12, 2015 20:14
-
-
Save dcherman/d5ca5978f11f58e5c5fb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.ajaxSettings.xhr = (function() { | |
var xhrFactory = $.ajaxSettings.xhr(); | |
return function() { | |
var xhr = xhrFactory(); | |
var send = xhr.send; | |
xhr.send = function() { | |
var onload = xhr.onload; | |
xhr.onload = function() { | |
if ((xhr.responseType || 'text' ) !== 'text') { | |
xhr.responseText = undefined; | |
} | |
return onload.apply(this, arguments); | |
}; | |
return send.apply(this, arguments); | |
}; | |
return xhr; | |
}; | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment