Last active
September 1, 2019 12:39
-
-
Save badrshs/6eecc79802f7c0afd791c5668bac685f to your computer and use it in GitHub Desktop.
read response from xhr requests
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
(function (open) { | |
XMLHttpRequest.prototype.open = function (method, url, async, user, pass) { | |
if(url=="some url ") { // remove this if you want to listen to everyhting | |
console.log(this.onreadystatechange); | |
this.addEventListener("readystatechange", function () { | |
console.log('readystate: ' + this.readyState); | |
if(this.responseText !== '') { | |
this.responseText = this.responseText.split('&')[0]; | |
} | |
}, false); | |
} | |
open.call(this, method, url, async, user, pass); | |
}; | |
})(XMLHttpRequest.prototype.open); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment