Skip to content

Instantly share code, notes, and snippets.

@deanhume
Created August 19, 2015 10:48
Show Gist options
  • Save deanhume/f9a338d12aeb983b15be to your computer and use it in GitHub Desktop.
Save deanhume/f9a338d12aeb983b15be to your computer and use it in GitHub Desktop.
A simple POST request using the fetch API
fetch(url, {
method: 'POST',
headers: {
'auth': '1234'
},
body: JSON.stringify({
name: 'dean',
login: 'dean',
})
})
.then(function (data) {
console.log('Request success: ', data);
})
.catch(function (error) {
console.log('Request failure: ', error);
});
@rpralica
Copy link

Thank You great and simple explanation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment