Skip to content

Instantly share code, notes, and snippets.

@tincho
Created December 29, 2016 16:00
Show Gist options
  • Save tincho/64645b384a23e57f326491eb4007d856 to your computer and use it in GitHub Desktop.
Save tincho/64645b384a23e57f326491eb4007d856 to your computer and use it in GitHub Desktop.
Sample vainilla XHR get function
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