Created
May 21, 2016 17:33
-
-
Save btk/73e8de6e12a73ae0c0e44bc421ab9eb1 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
var getJSON = function(url, callback) { | |
var xhr = new XMLHttpRequest(); | |
xhr.open("get", url, true); | |
xhr.responseType = "json"; | |
xhr.onload = function() { | |
var status = xhr.status; | |
if (status == 200) { | |
callback(null, xhr.response); | |
} else { | |
callback(status); | |
} | |
}; | |
xhr.send(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment