AJAX

January 18, 2018

XMLHttpRequest

var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
  if (this.readyState === 4 && this.status === 200) {
    var result = JSON.parse(xhr.responseText);
    console.log(result);
  }
}
xhr.open('GET', '/james.json', true);
xhr.send();

Examples