I refreshed the page on my weather project and all my javascript broke

I refreshed the page on my weather project and all my javascript broke
0.0 0


https://codepen.io/cyndlmoore/pen/ZKjMrw Can you see any errors? My JS was working perfectly until I accidentally hit F5, so I have no idea what I could have done to break it. I was working on adding the background images when this happened so maybe I messed up something around there.


Add another " }); " to line 95

UPD: Oh, maybe I’m too late, that prevents overall crash of codepen, but does not start application logic…

UPD2: try to use cross-origin when getting JSON data (to avoid HTTP-HTTPS barrier): https://cors-anywhere.herokuapp.com/http://ip-api.com/json,
this makes app work on my machine


You fixed it again, thanks!


Errrrrrr except now it thinks I’m in a place called Ashburn (Georgia???) for some reason. How to fix that? Just http://ip-api.com/json detects my location fine.


Yes seems like i am here in Ashburn too :open_mouth:
Cross-origin somehow changes visible IP address - and in fact - AJAX request grabs coordinates of another machine placed in Georgia?..

OK, sorry but that way with cors-anywhere revealed not good to detect coordinates… In other cases it works properly, so now we only need to get correct coordinates.
Try to get them by browser geolocation (i used this in my app and it works correctly):

// example
clientCoords.lat = position.coords.latitude.toFixed(4);
clientCoords.lon = position.coords.longitude.toFixed(4);