fetch
('https://crossorigin.me/https://www.metaweather.com/api/location/2487956/')
.then(result => {
console.log(result);
return result.json(); //fetch () will return a promise and converting to json object
})
.then(data=>console.log(data))
.catch(error => {
console.log(error);
});
here https://crossorigin.me is used to prevent same origin policy.
No comments:
Post a Comment