I'm stuck. Any ideas?

I’m stuck on Local Weather. This is what I have so far: link.

I’ve hit a wall, and at the moment I’m not even sure how to move forward. I tried making the API call to OpenWeather, but I never managed to get it working. (unfortunately I deleted that code in frustration, so I can’t show it) I don’t even know where to go from here. I’ve tried searching and reading docs and the forums, and I don’t even have an idea what it is I’m missing. I could just copy/paste code, but I want to actually learn this stuff. Can anyone give me an idea of what the next step is? Or do you have any videos or articles or anything that you think might help?

I’m really drawing a blank, so anything will be appreciated.

Did you get any particular error messages that you recall?

A typical problem that arises from the weather app is this: Browser based geolocation only works over https, but openweathermap serves responses over http (so you get a mixed media error). To fix this you can look up your user’s location based on their IP address, or use a weather API that serves over https. You can search the forum for previous answers to weather app questions that show examples of these.

1 Like

Go to link below and watch video it really makes clear how to send requests … i personally didnt understand what was happening when i did the fcc lesson … (it was too simple i missed it lol) …
but after a bit of googling i realised it was pretty easy.
Ok first off your getting your loc and lat locations with a request and that part is working.
you have your open weathermap url and your key … so what you need to do next is send another request and it will return the information.
but you cant just put another request straight under the first one … reason being is when the first request is sent … even though its very quick the code is still running and before the result comes back with the lat and loc any code will have being run eg if you have another request underneath referencing the loc and lat results … that will already have being run before it got the lat and loc from the first request.
what i did was create a function for the second request … that took two paramaters eg lat and loc … and in the first request at the end of it i called this function and passed it the lat and loc … this way the first request is run but the second request cant run until it is called after the lat and loc are returned by the first request. …
Hope this helps

1 Like


it was all correct apart from some omossions, so you were on the right track.

Your api url (link var) needed the http://

var link = "http://api.openweathermap.org/data/2.5/weather?lat=" + lat + "&lon=" + lon + "&APPID=KEYREMOVED";

Then we need to call the API, if you look in your console log you will see the json response appears.

  $.getJSON(link, function(gotByGeo) {



1 Like

THANK YOU!!! :grin:
I think that’s what I needed. Thank you all :slight_smile:

1 Like