Help needed with Local Weather app

Help needed with Local Weather app
0

#1

Hi

I seem to have run into a problem with my code in this project which I can not figure out for the life of me. As far as I can tell from looking at the networking tab in developer tools Codepen is stopping the script from running because of an infinite loop but I have no idea where there could be an infinite loop in the code.

I would really appreciate if someone could have a look at my code https://codepen.io/Arty05/pen/XKzzrr and see if they can spot the reason because at the minute I am oblivious to the error.

Thanks

Anthony


#2

Hi
Openweathermap doesn’t work with the https protocol. If you change your codepen address to just plaint http and run the app it will work. You’ll need to use a cors server to overcome this. I am using https://cors-anywhere.herokuapp.com/ You just add that address in front of the openweathermap address in your api call.

Hope that helps :slight_smile:


#3

Thank you very much, changing the Codepen address to http worked straight away! I spent hours just staring at code trying to figure out how there was an infinite loop like the error suggested and never even considered changing to http, at least I will not make that mistake again.


#4

Glad I could help. The only reason I knew what was going on is because I had the same problem. It’s really frustrating, isn’t it? Anyway, have fun finishing the project :slight_smile: