Sending Data with fetch

To send data to an API, give fetch a second argument with method POST, a Content-Type header that says the body is JSON, and a body made with JSON.stringify; and know that CORS, the API's rule about which sites may call it, decides whether a page can call it at all.

Updated

Cheat sheet: Sending Data with fetch
Category
JavaScript
Level
Journeyman
Tags
<header>, Content-Type, CORS, JavaScript, JSON.stringify(), POST, Request Body (rest-api), rest-api, web-development