Fetch POST Call

PHOTO EMBED

Wed Jun 22 2022 15:24:30 GMT+0000 (Coordinated Universal Time)

Saved by @zaccamp #javascript

const url = 'https://jsonplaceholder.typicode.com/users';

let data = {
  name: 'Sammy'
}

let request = new Request(url, {
  method: 'POST',
  body: JSON.stringify(data),
  headers: new Headers({
    'Content-Type': 'application/json; charset=UTF-8'
  })
});

fetch(request)
  .then(function() {
    // Handle response you get from the API
  });
content_copyCOPY

https://www.digitalocean.com/community/tutorials/how-to-use-the-javascript-fetch-api-to-get-data