Fetch vs. AjaxCall
<p>What is the difference between typical AJAX and Fetch API?</p>

<p>Consider this scenario:</p>

<pre><code>function ajaxCall(url) {
  return new Promise(function(resolve, reject) {
    var req = new XMLHttpRequest();
    req.open('GET', url);

    req.onload = function() {
      if (req.status == 200) {
        resolve(req.response);
      } else {
        reject(Error(req.statusText));
      }
    };
    req.onerror = function() {
      reject(Error("Network Error"));
    };
    req.send();
  });
}

ajaxCall('www.testSite').then(x =&gt; {
  console.log(x)
}) // returns html of site

fetch('www.testSite').then(x =&gt; {
  console.log(x)
}) // returns object with information about call
</code></pre>

<p>This is what the <code>fetch</code> call returns:</p>

<pre><code>Response {type: "cors", url: "www.testSite", status: 200, ok: true, statusText: "OK"…}
</code></pre>

<p>Why does it return different things?</p>

<p>Is there a way for <code>fetch</code> to return the same thing as a typical AJAX call?</p>