Created
December 24, 2014 13:58
-
-
Save JSila/fb7590798b631de34ff4 to your computer and use it in GitHub Desktop.
simple ajax get request
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
function get (url, callback) { | |
var request = new XMLHttpRequest(); | |
request.onreadystatechange = function () { | |
if (request.readyState == 4 && request.status == 200) | |
callback(request.responseText) | |
} | |
request.open('GET', url, true) | |
request.send() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment