Answer the question
In order to leave comments, you need to log in
Why doesn't it take data from api weather?
Hello. There is a site openweathermap.org , which has api, make direct requests and take weather data. api.openweathermap.org/data/2.5/weather?q=London here is an example, but weather says undefined.
$.ajax({
url : "http://api.openweathermap.org/data/2.5/weather?q=London",
datatype:'json',
success : function(data) {
alert(data.weather.id);
}
});
Answer the question
In order to leave comments, you need to log in
Maybe because data.weather is an array?
Try this
. Why not immediately check through console.dir(data) what kind of data is coming?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question