Weather App Project


#1

Hello, I am a newbe and i am at the weather app project! I have written some code trying to implement the fcc api for the weather but i am stuck and dont know where are my mistakes!
https://codepen.io/Stivi7/pen/NvdomP here is the code i have written this far!
Any advice will help!

Regards! :slight_smile:


#2
  • First you pushed lat/lon into a variable. You want to pull that in your getJSON, but you did just make them part of the URL string so they will not be replaced with the variables.

β€œhttps://fcc-weather-api.glitch.me/api/current?lon=:long&lat=:lat”

–> β€œhttps://fcc-weather-api.glitch.me/api/current?lon=” + long + β€œ&lat=” + lat

then check if you are actually getting the right properties from the returned JSON


#3

i did the url change but i am stuck at the getJSON function below
https://codepen.io/Stivi7/pen/NvdomP


#4

You need to look at the returned JSON, you are not accessing the values properly:

Example : data.weather[0].icon

… Read again how to access JSON properties…