JavaScript Fetch API - Ajax - Request

PHOTO EMBED

Wed Oct 28 2020 08:30:04 GMT+0000 (Coordinated Universal Time)

Saved by @julien #javascript #ajax

// GET Request.
fetch('https://api.github.com/users/rich-harris')
  // Handle success
  .then(response => response.json())  // convert to json
  .then(json => console.log(json))    // print data to console
  .catch(err => console.log('Request Failed', err)); // Catch errors
content_copyCOPY

https://medium.com/javascript-in-plain-english/the-ultimate-javascript-fetch-api-cheatsheet-e60b98c8cdbe