-
-
Save blaja/17ef8984fee54786d2ce to your computer and use it in GitHub Desktop.
Fetch some JSON using Fetch API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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