Last active
July 20, 2016 00:18
-
-
Save avand/063448ca7d475983e42bd3d331b83d63 to your computer and use it in GitHub Desktop.
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
// 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