游.程 2020-03-26 12:07 采纳率: 0%
浏览 60

显示海图的天气

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]+" &degC";
    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.

  • 写回答

0条回答 默认 最新

    报告相同问题?