Example 1 — From a form element
In pages with a
Create new FormData(), append fields, then fetch(url, { method:"POST", body: fd }). Do not set Content-Type manually—the browser adds the boundary.
const fd = new FormData();
fd.append("title", "Note");
console.log(fd.has("title"));
console.log(fd.get("title"));In pages with a
CODETOFUN NEWS
Get the latest IT news, programming updates, and technology trends directly on your phone.
Your daily dose of tech, straight to your feed.
6 people found this page helpful