code: function getJSON (url) {
    return new Promise((resolve, reject) => {
      var xhr = new XMLHttpRequest();
      xhr.open('get', url, true);
      xhr.onreadystatechange = function() {
        var status;
        var data;
        if (xhr.readyState === 4) { // `DONE`
          status = xhr.status;
          if (status === 200) {
            data = JSON.parse(xhr.responseText);
            resolve(data);
          } else {
            reject(status);
          }
        }
      };
      xhr.send();
    });
  }
docs: From https://mathiasbynens.be/notes/xhr-responsetype-json