This is the first time we're dirtifying our hands with Fetch HTML5 API and Ractive JS .
We've this code here which is not throwing any error.
Notice the
no-cors
header set as the request parameter.
We just need to get the free API data from the Open Weather Map guys .
How to fix that opaque response in RactiveJs with HTML5 Fetch API
Your code needs to correct the following errors
api.openweathermaps.org
not sample.openweathermaps.org
GET
not POST
fetch('http://api.openweathermap.org/data/2.5/weather?q=London,uk&appid=**valid api key**', {
method: 'GET',
redirect: 'follow'
})
.then(response => response.json())
.then(data => console.dir(data));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.