Hilfe für Abfrage HTML
Hallo zusammen
Ich habe einen HTML code wo ich Wetterdaten abfrage, dieser läuft soweit, was ich aber noch einbinden möchte, ist eine if Bedingung für die Stadt und ob es zur Zeit
Regnet oder Schön ist.
Leider komme ich auf keine Lösung, hat jemand eine Idee?
Danke
Klaus
-----------------------------------------------------------------------------------------------------
<html>
<head>
<title>Weather</title>
<meta charset="utf-8">
<s***** src="http://code.jquery.com/jquery-1.7.min.js" ></s*****>
<s***** src="http://code.jquery.com/ui/1.7.0/jquery-ui.js" ></s*****>
<s*****>
function getWeather(callback) {
var weather = 'http://api.openweathermap.org/data/2.5/forecast?lat=50.9417&lon=6.95516&units=metric';
$.ajax({
dataType: "jsonp",
url: weather,
success: callback
});
}
// get data:
getWeather(function (data) {
console.log('weather data received');
console.log(data.list[0].weather[0].des*****ion);
console.log(data.list[0].weather[0].main);
});
</s*****>
</head>
<body>
<div class="wrapper">
<s*****>
getWeather(function (data) {
document.getElementById('cond').innerHTML= data.list[0].weather[0].main;
document.getElementById('city').innerHTML= data.city.name;
document.getElementById('temp').innerHTML= parseInt(data.list[0].main.temp) + ' °C';
});
</s*****>
<h1 id="city"></h1>
<div class="ppal">
<div id="img"></div>
<div id="temp"></div>
<div id="cond"></div>
</div>
</div>
</body>
</html>
|