0Pricing
JavaScript Academy · Lesson

POST and Sending Data

Send JSON payloads with request options.

Sending Data to a Server

To create or update data you send a request with a body. Fetch supports this through the options object passed as the second argument.

Setting the Method

Set method to the HTTP verb you need: POST to create, PUT/PATCH to update, DELETE to remove.

fetch(url, { method: "POST" });

All lessons in this course

  1. Making GET Requests
  2. POST and Sending Data
  3. Handling Errors and Status Codes
  4. Aborting Requests with AbortController
← Back to JavaScript Academy