Tuesday, 7 July 2015

How to get weather data from api

just try to run the query in browser and check the result in console window .
just add some string after ?q="AnyStateName"

like ?q=London

var city = $('#city').val(); 
$.get("api.openweathermap.org/data/2.5/weather?q="; + city, function (data, status) {
 console.log(status);

 $.each(data, function (index,value)

 { 
console.log(index + ": " + value);

}



}); 

},"JSON");


and getting this success

 coord: [object Object]

sys: [object Object]

weather: [object Object] 

base: stations

 main: [object Object] 

wind: [object Object]

 clouds: [object Object] 

 rain: [object Object] 

 dt: 1436184609 

 id: 1259229 

name: Pune 

cod: 200