I tryed to display the weather, wind, temp, pressure in Highchart, but it won´t work. Maybe sth missing in my code. My second point is, that i want to insert a picture which change with the weather.
var dataArray = new Array([]);
var prefs = new Array([]);
loadDashboard();
setInterval(function() {
loadDashboard();
}, 60000);
function loadDashboard(){
dataArray = getData(inputArray).split(',');
document.getElementById("temp").innerHTML= dataArray[1]+" °C";
document.getElementById("wind").innerHTML= dataArray[4]+" "+prefs[4][4];
document.getElementById("press").innerHTML= dataArray[0]+" "+prefs[0][4];
document.getElementById("hum").innerHTML= Math.round(dataArray[2]*100)/100+" "+prefs[2][4];
}
function getPrefs(index) {
var tmp = null;
$.ajax({
'async': false,
'type': "POST",
'global': false,
// 'dataType': 'html',
'url': 'connPrefs.php?tagId='+inputArray[index]+'&n=1',
'data': { 'request': "", 'target': 'arrange_url', 'method': 'method_target' },
'success': function (data) {
tmp = data;
}
});
return tmp;
}
// PRELOAD DATA: index is the index of inputArray from parameter
function getData(index) {
var tmp = null;
$.ajax({
'async': false,
'type': "POST",
'global': false,
// 'dataType': 'html',
'url': 'connPolar.php?tagId='+index+'&n=1',
'data': { 'request': "", 'target': 'arrange_url', 'method': 'method_target' },
'success': function (data) {
tmp = data;
}
});
return tmp;
}
And i don´t need the HTML data, just need the js code.