Skip to content

Instantly share code, notes, and snippets.

@blaja
Created August 1, 2015 14:34
Show Gist options
  • Save blaja/17ef8984fee54786d2ce to your computer and use it in GitHub Desktop.
Save blaja/17ef8984fee54786d2ce to your computer and use it in GitHub Desktop.
Fetch some JSON using Fetch API
const request = new Request('https://output.jsbin.com/pasixu.js', {
method: 'GET',
requestMode: 'cors',
});
fetch(request).then(function(response) {
return response.json();
}).then(function(body) {
console.log(body);
}).catch(function(){
console.log('Error');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment