Created
November 7, 2016 00:11
-
-
Save raphaelpor/ef7482441acd244c7a97ef0713f533dd to your computer and use it in GitHub Desktop.
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 config = { | |
method: 'POST', | |
body: JSON.stringify({ cat: 'grumpy' }), | |
cache: 'no-cache', | |
mode: 'no-cors', | |
} | |
fetch('http://localhost:8080/cats?categ=10&type=5', config) | |
.then(response => { | |
if(response.ok) { | |
return response.json(); | |
} | |
}) | |
.then(data => { | |
console.log(data); | |
}) | |
.catch(err => { | |
console.log(err.message); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment