Skip to content

Instantly share code, notes, and snippets.

@zzarcon
Created March 20, 2016 20:01
Show Gist options
  • Select an option

  • Save zzarcon/e07b5edcea6d6ee13a0b to your computer and use it in GitHub Desktop.

Select an option

Save zzarcon/e07b5edcea6d6ee13a0b to your computer and use it in GitHub Desktop.
XMLHttpRequest
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = callback;
xhr.open("GET", "https://api.github.com/users/zzarcon");
xhr.send();
function callback() {
if (xhr.readyState == 4 && xhr.status == 200) {
var json = JSON.parse(xhr.responseText);
console.log(json.name);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment