browser fetch post code example
Example 1: how to post data using fethch
fetch('url here', {
method: 'POST',
headers: {'Content-Type':'application/x-www-form-urlencoded'}, // this line is important, if this content-type is not set it wont work
body: 'foo=bar&blah=1'
});
Example 2: javascript fetch api get
fetch('http://example.com/movies.json')
.then(response => response.json())
.then(data => console.log(data));