Help using the APIs for Weather Project

My project so far :


I really don’t know why my API calls do nothing . What am I doing wrong ?

If you look in the console you’ll see it’s about insecure request. Put https and it should work? I tried in your pen and it seemed to solve it.

Indeed now location is working ,for which I thank you a lot . But the weather info is still not changing .

If you look on the forums you’ll see lots of people have had that problem on codepen. I think you should find an answer there - maybe they’ll tell you to use another api. Sorry for not being able to help more.

Thanks for everything , buddy . I’m just doing that , hope I’ll find something :slight_smile: .

In case you haven’t solved it:

Since you are using https the weather api should be over https as well. Since Openweathermap doesn’t offer https requests, you will have to use something like https://cors-anywhere.herokuapp.com.

You can use it by changing userWeatherAPI to var userWeatherAPI = "https://cors-anywhere.herokuapp.com/http://api.openweathermap.org/data/2.5/weather?q=" + city + "," + country + "&appid=" + weatherAPIkey ;

This will only partly solve the problem. It will now show the weather condition, but not the temperature. That is because all your convertXtoY functions don’t return anything.

Thank you a lot ! I was indeed searching for another weather API , you saved my day :smile: .