Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/410.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Highcharts getJSON不工作_Javascript_Json_Highcharts - Fatal编程技术网

Javascript Highcharts getJSON不工作

Javascript Highcharts getJSON不工作,javascript,json,highcharts,Javascript,Json,Highcharts,我一直在努力让Highcharts工作,但是JSON不起作用 我的JSON只是从他们的示例中复制数据,但在我自己的服务器上: 我的Javascript是: $.getJSON('./servercount.json', function(data) { Highcharts.chart('container', { chart: { zoomType: 'x' }, data: { data: data }, title:

我一直在努力让Highcharts工作,但是JSON不起作用

我的JSON只是从他们的示例中复制数据,但在我自己的服务器上:

我的Javascript是:

$.getJSON('./servercount.json', function(data) {

  Highcharts.chart('container', {
    chart: {
      zoomType: 'x'
    },
    data: {
      data: data
    },
    title: {
      text: 'CakeBot Stats'
    },
    xAxis: {
      type: 'datetime'
    },
    yAxis: {
      title: {
        text: 'Value'
      }
    },
    legend: {
      enabled: true
    },
    plotOptions: {
      area: {
        fillColor: {
          linearGradient: {
            x1: 0,
            y1: 0,
            x2: 0,
            y2: 1
          },
          stops: [
            [0, Highcharts.getOptions().colors[0]],
            [1, Highcharts.Color(Highcharts.getOptions().colors[0]).setOpacity(0).get('rgba')]
          ]
        },
        marker: {
          radius: 2
        },
        lineWidth: 1,
        states: {
          hover: {
            lineWidth: 1
          }
        },
        threshold: null
      }
    },

    series: [
      {
        type: 'area',
        name: 'Servers',
        data: data
      },
      {
        type: 'area',
        name: 'Members',
        data: data
      }
    ]
  });
});
图表无法加载:


有什么想法吗?

在浏览器开发工具网络选项卡中检查您的ajax请求和响应。它可以抓取文件。我通过使用JSONPNow使其正常工作,我看到所有这些都正常工作,对吗?