Stuck on Local Weather project

Stuck on Local Weather project
0

#1

Project Link - http://codepen.io/codejsp/pen/YNxBmg
I don’t understand why my city isn’t showing up on my list.


#2

You define var api before you give lat and long a value.

So, use this:

    var lat = data2.lat;
    var long = data2.lon;
    var api = 'http://api.openweathermap.org/data/2.5/weather?lat='+lat+'&lon='+long+'&appid=617c70da1e9d92ef037ce2a629638af3';

Instead of:

    var lat;
    var long;
    var api = 'http://api.openweathermap.org/data/2.5/weather?lat='+lat+'&lon='+long+'&appid=617c70da1e9d92ef037ce2a629638af3';
    lat = data2.lat;
    long = data2.lon;

#3

thanks for quick reply, working now. :grin:
Follow up question: so does it goes in order from top to bottom? because i didn’t define lat and long (which is in my api) before api registered?(don’t know correct term)


#4

You mean that you didn’t state something like var lat; before your $.getJSON(ip-api..)?


#5

nvm forget what i said =P