Вот мой код:
Код: Выделить всё
Weather
function gettingJSON(){
var city = document.getElementById('text').value;
document.write("jquery loaded");
$.getJSON(`http://api.openweathermap.org/data/2.5/weather?q=${city}&APPID=${my API key}`,function(data){
document.write(JSON.stringify(data));
});
}
Get JSON
Код: Выделить всё
jquery loaded{"coord":{"lon":-0.13,"lat":51.51},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01n"}],"base":"stations","main":{"temp":273.85,"feels_like":270.59,"temp_min":273.71,"temp_max":274.26,"pressure":1006,"humidity":92},"visibility":10000,"wind":{"speed":1.73,"deg":308},"clouds":{"all":0},"dt":1609436849,"sys":{"type":3,"id":2019646,"country":"GB","sunrise":1609401973,"sunset":1609430448},"timezone":0,"id":2643743,"name":"London","cod":200}
Подробнее здесь: https://stackoverflow.com/questions/655 ... tjson-call