not logged in | [Login]

Javascript snippets

HTTP POST with Fetch

fetch('/some/api', {
    method: 'post',
    credentials: 'include'
  })
  .then(function (data) {
    console.log('Request succeeded with JSON response', data);
  })
  .catch(function (error) {
    console.log('Request failed', error);
  });