Weather App-- {"error":"Please provide longitude as lon and latitude as lat as numbers/floats."}

Weather App-- {"error":"Please provide longitude as lon and latitude as lat as numbers/floats."}
0

#1

Hello! I am needing help with getting a response from the FCC weather api. I know others have posted about this, but as far as I can tell, the string I am sending to the api is correct. I must be doing something wrong though, keep getting this error:

{“error”:“Please provide longitude as lon and latitude as lat as numbers/floats.”}

Thanks!


#2

In your url:

      var url = "https://fcc-weather-api.glitch.me/api/current?lat=:"+lat+"&lon="+lon;

There is a colon after equals sign after the “lat” - get rid of that. It should be.

      ...lat="+lat+"&lon="+lon;

#3

Thank you so much, have never been so happy to see that beautiful JSON data reply from the api.


#4

Trust me, we’ve all been there - had a silly little error that drove us crazy and then had that moment of ecstasy when we finally got it to work.