Created
June 15, 2012 17:57
-
-
Save skinp/2937866 to your computer and use it in GitHub Desktop.
Ajax function call
This file contains hidden or 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 ajax(url, callback) { | |
var x = new XMLHttpRequest(); | |
x.onreadystatechange = function(){ | |
if (x.readyState == 4) { | |
callback(x.responseText); | |
} | |
}; | |
x.open("GET", url); | |
x.send(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment