xxxxxxxxxx
fetch('https://example.com/profile', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
'foo': 'bar'
}),
})
.then((res) => res.json())
.then((data) => {
// Do some stuff ...
})
.catch((err) => console.log(err));
The POST method is one of the HTTP methods used in web development for sending data to a server. It is commonly used when you want to submit data to be processed and stored on the server, such as submitting a form on a website or creating a new resource.