title: E6 Ajax request not working
body: <p>I have a script where I want to fetch some json data from an endpoint, but I get an error, this is my script:</p>
  
  <pre><code>function httpGet(url) {
      return new Promise(
          function (resolve, reject) {
              var request = new XMLHttpRequest();
              request.onreadystatechange = function () {
                  if (this.status === 200) {
                      // Success
                      resolve(this.response);
                  } else {
                      // Something went wrong (404 etc.)
                      reject(new Error(this.statusText));
                  }
              }
              request.onerror = function () {
                  reject(new Error(
                      'XMLHttpRequest Error: '+this.statusText));
              };
              request.open('GET', url);
              request.send();
          });
  }
  
  var url = 'https://api.jsonPlaceholder.com';
  
  httpGet(url)
    .then(JSON.parse)
    .then((r) =&gt; {
      console.log(r);
    }).catch(function(error) {
      console.log(error);
    });
  </code></pre>
  
  <p>Then, in the console it throws an error:</p>
  
  <blockquote>
    <p>Error
        at XMLHttpRequest.request.onreadystatechange (app.js:11)
        at app.js:18
        at Promise ()
        at httpGet (app.js:2)
        at app.js:25</p>
  </blockquote>