Created
September 20, 2019 01:40
-
-
Save ledangtuanbk/5ddb8ee96030a8d4839dfa1b9daf7f7d to your computer and use it in GitHub Desktop.
check cors online
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
1. go to page with http | |
2. in console run this command to check | |
fetch('./api/some.json') | |
.then( | |
function(response) { | |
if (response.status !== 200) { | |
console.log('Looks like there was a problem. Status Code: ' + | |
response.status); | |
return; | |
} | |
// Examine the text in the response | |
response.json().then(function(data) { | |
console.log(data); | |
}); | |
} | |
) | |
.catch(function(err) { | |
console.log('Fetch Error :-S', err); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://developers.google.com/web/updates/2015/03/introduction-to-fetch