Your first AJAX request with fetch

AJAX asks the server for data without reloading the page. fetch returns a promise.

AJAX · Your first AJAX request with fetchBeginner
fetch('/api/items')
  .then(function (response) { return response.json(); })
  .then(function (data) { console.log(data); });
fetchbasicsgetjson