Created
March 17, 2015 11:54
-
-
Save izumskee/953a57c24b0135f61783 to your computer and use it in GitHub Desktop.
XMLHttpRequest example
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
var httpRequest; | |
if (window.XMLHttpRequest) { | |
httpRequest = new XMLHttpRequest(); | |
} else if (window.ActiveXObject) { | |
// Internet Explorer | |
httpRequest = new | |
ActiveXObject("Microsoft.XMLHTTP"); | |
} | |
httpRequest.onreadystatechange = function () { | |
if (httpRequest.readyState === 4 && httpRequest.status === 200) { | |
callback.call(httpRequest.responseXML); | |
} | |
}; | |
httpRequest.open('GET', url); | |
httpRequest.send(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment