Skip to main content
Home

User account menu

  • Log in
JavaScript
mozilla.org

You can send data with the application/x-www-form-urlencoded content type (the one that encodes values similar to a query string, e.g. first=1&second=2) using a URLSearchParams object, like so:

fetch(url, {
  method: "POST",
  body: new URLSearchParams({first: 1, second: 2})
});

Other formats are explained in the Mozilla docs.

Previous on JavaScript
You can access the body and html elements by using document.body and document.documentElement, respectively.

Copyright 2019 · All rights reserved

Author: