无法在FTP上读取PHP中的JSON

时间:2013-06-26 15:40:49

标签: php jquery json ftp highstock

我在zymic.com上设置了FTP。我有一个jsonfile名称testJson.json和一个名为index.php的php文件(显然是默认值)。我在testJson.json文件中有一些来自传感器的温度数据。我想使用highcharts在网站(index.php)上显示它。我在同一目录下有testJson.json和index.php文件。 虽然我相信我做得对,但我没有得到结果。下面是我的index.php代码

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript"      src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script type="text/javascript">
$(function() {
   $.getJSON('testJson.json', function(data) {
      // Create temperature chart
      $('#container').highcharts('StockChart', {
         rangeSelector : {
    selected : 1
     },
         title : {
    text : 'Temperature graph in °C'
     }, 
     series : [{
    name : 'Temperature',
    data : data,
    tooltip: {
       valueDecimals: 2
    }
     }]
      });
   });
});

</script>
</head>
<body>
<script src="Highstock-1.3.2/js/highstock.js"></script>
<script src="Highstock-1.3.2/js/modules/exporting.js"></script>
<div id="container" style="height: 500px; min-width: 500px"></div>
</body>
</html>

1 个答案:

答案 0 :(得分:1)

我认为你需要在加载hightstock.js和exports.js后放置脚本