Skip to content

Instantly share code, notes, and snippets.

@cyrilletuzi
Created February 5, 2017 12:10
Show Gist options
  • Save cyrilletuzi/487314b3964c7c218c432fb65cb37173 to your computer and use it in GitHub Desktop.
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