Last active
September 24, 2021 10:35
-
-
Save BrunoGiubilei/a6c604e8f29c90b2b3aa45d61364743b to your computer and use it in GitHub Desktop.
Fetch em javascript puro
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
fetch(url) | |
.then((resp) => resp.json()) | |
.then(function(data) { | |
console.log(data); | |
}); | |
// se por acaso o CORS reclama | |
fetch(url,{ | |
mode: 'no-cors' | |
}) | |
.then((resp) => resp.json()) | |
.then(function(data) { | |
console.log(data); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment