Skip to content

Instantly share code, notes, and snippets.

@dev-tim
Last active September 7, 2019 14:23
xhr
function get(url, callback) {
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState == XMLHttpRequest.DONE) {
callback(xhr.responseText)
}
}
xhr.open('GET', url, true);
xhr.send(null);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment