I’ve been trying to get started on the Show the Local Weather challenge and have got completely stuck.
The worst problem is that my current code originally worked! However when I came back to it the next day to carry on working on it, it didn’t work and I haven’t been able to get it to work since.
Does anyone mind having a look and maybe see what I’m doing wrong? I know I have to use the user’s current location but I just put in my own location at first to try and get it working before worrying about that.
Huh. Some places are just more fun to work at than others.
TypeError: undefined is not an object (evaluating 'e.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED')
The heart of this issue is browser security. You’re connected to CodePen via HTTPS, which is good, but you’re trying to access remote resources that are not securely hosted (via HTTP), which is not good. The simplest solution at this point is to tack https://crossorigin.me in front of your apiURL.
var apiURL =
"https://crossorigin.me/http://api.openweathermap.org/data/2.5/weather?q=Plymouth,uk&APPID=339aeea1f4e7888fdcac76a9fa4ba74c&units=metric";`
Codepen.io is using HTTPS protocol, while the site you’re making ajax requests to, OpenWeather, is using HTTP protocol. For more information, see this link. If you export your code as zip & run it on your local machine, I hope it’ll work.
I have been doing the weather app challenge also. The Open Weather Api has some issues as its free version uses http and codepen uses https so mixed content warning is displayed.
I used this API here in my project, its free and uses https, so no warnings are there and the app works perfectly.
Also my weather app that i completed today only is here
Thanks for posting that Kush, I had further problems with Open Weather Map so decided to give the Axipu one a try and seems to be working great so far. It is working with the geolocation function too which is a bonus. And all with HTTPS!