Skip to content

Instantly share code, notes, and snippets.

@blaja blaja/.js
Created Aug 1, 2015

Embed
What would you like to do?
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
You can’t perform that action at this time.