I’ve been told the geolocation is depreciated but I can still console.log the lat and long just fine. The JSON data doesn’t seem to be translating for some reason. Any ideas?
Thanks!
I had the same issue, and decided to use “http://freegeoip.net/json/” for the location instead.
You can get around it by forcing the codepen to be secure “https” but the run into other problems…
Good luck!
It isn’t. Browsers are updating their security policies to disable data sharing services (geolocation in particular) over HTTP connections. Your AJAX call isn’t working because you must use HTTPS for geolocation to work and you cannot access an endpoint over HTTP if your site is hosted over HTTPS. This comes up frequently on this forum and I suggest a search if you want more details. Try prepending a CORS proxy onto your API URL:
http://cors-anywhere.herokuapp.com/http://api.openweathermap.org/yadda/yadda
Cors-anywhere is a server that intercepts your data and does some magic and stuff. Hopefully that will help.
Thank you so much!! That worked. YAY!!! Been working on that for 3 days. grrrrr
Will be starting the weather app again soon, glad this was brought up!