Skip to content

Instantly share code, notes, and snippets.

@cyrilletuzi
Created February 5, 2017 12:10
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save cyrilletuzi/487314b3964c7c218c432fb65cb37173 to your computer and use it in GitHub Desktop.
/* Get HTML content */
fetch('/api')
.then((response) => response.text())
.then((responseText) => {});
/* Get JSON data */
fetch('/api')
.then((response) => response.json())
.then((responseJson) => {});
/* Post */
fetch('/api', { method: 'post' });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment