1

我正在尝试使用 var point 使用 PHP recourd 更新数据字段。这是我的PHP代码:

  $query_Recordset1 = "SELECT * FROM table";
  $Recordset1 = mysql_query($query_Recordset1, $egrid) or die(mysql_error());
  $row_Recordset1 = mysql_fetch_assoc($Recordset1);
  $totalRows_Recordset1 = mysql_num_rows($Recordset1);
  $Peak = mysql_result($Recordset1 ,0,"Peak");
  print $Peak;

PHP 脚本确实有效,但是当我尝试将其插入到我的 .js 文档中时,什么也没有发生。这是我的javascript:

    series: [{
        name: 'Peak Average',
        data: [18000],  //interval update in Add some life
        tooltip: {
            valueSuffix: ' Peak'
        }
    }]

},
 // Add some life
 function(chart) {
  setInterval(
     function() {
        var point = chart.series[0].points[0], newVal;
        $.get("peak.php", function(newVal) {
                console.log(newVal, typeof newVal);
                point.update(parseFloat(newVal));
        });
     }    
  ,5000);
 });

我什至尝试根据字符串与数字进行调整:

  point.update(newVal);

请帮忙。

4

0 回答 0