Skip to content

Instantly share code, notes, and snippets.

@avand
Last active July 20, 2016 00:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save avand/063448ca7d475983e42bd3d331b83d63 to your computer and use it in GitHub Desktop.
Save avand/063448ca7d475983e42bd3d331b83d63 to your computer and use it in GitHub Desktop.
// Declare our get function...
function get(url, callback) {
var request = new XMLHttpRequest();
request.open("GET", url, true);
request.addEventListener("readystatechange", handleReadyStateChange)
function handleReadyStateChange() {
if (request.readyState == 4 && request.status == 200) {
callback(request.responseText);
}
};
request.send();
}
// Call our get function...
get("https://api.github.com/users/avand", console.log);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment