Code: Select all
function updateweather(){
var url = "http://192.168.178.29:8080/json.htm?type=devices&rid=96";
var forecast
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
var myArr = JSON.parse(xmlhttp.responseText);
forecast = myArr.result[0].ForecastStr;
console.log("Forecast is "+forecast+".")
// myFunction(myArr);
if (forecast == "Partly Cloudy") {
}
if (forecast == "Sunny") {
}
if (forecast == "Rain") {
}
if (forecast == "Fog") {
}
if (forecast == "Snow") {
}
if (forecast == "Cloudy") {
}
}
}
xmlhttp.open("GET", url, true);
xmlhttp.send();
setTimeout(updateweather,6000);
}
//-->
</script>