Created
December 29, 2016 16:00
-
-
Save tincho/64645b384a23e57f326491eb4007d856 to your computer and use it in GitHub Desktop.
Sample vainilla XHR get function
This file contains 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 getData(uri, done, evt) { | |
var request = new XMLHttpRequest(); | |
request.open('GET', uri); | |
request.onreadystatechange = function() { | |
if(! (request.readyState == 4 && request.status === 200)) { | |
return; | |
} | |
return done(request); | |
}; | |
request.send(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment