Skip to content

Instantly share code, notes, and snippets.

@skinp
Created June 15, 2012 17:57
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 skinp/2937866 to your computer and use it in GitHub Desktop.
Save skinp/2937866 to your computer and use it in GitHub Desktop.
Ajax function call
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