【发布时间】:2014-10-21 18:00:32
【问题描述】:
我正在使用这个code - Jfiddle link 创建美国的数据地图。我想通过使用本地存储的文件来修改示例中的数据集。
数据似乎存储在位于以下位置的文件中:http://www.highcharts.com/samples/data/us-population-density.json。
我将文件名更改为本地驱动器,但无法加载图表。我需要进行哪些更改?
参考我的本地驱动器:
$.getJSON('http://www.highcharts.com/samples/data/jsonp.php?filename=C:/us-population-density.json&callback=?', function (data) {
【问题讨论】:
-
您不能使用 AJAX 从驱动器加载文件(至少在 Chrome 中不能)。请参阅 this question 或 this one 以及许多其他人......
-
您需要任何网络服务器来加载数据,因为浏览器会阻止从文件系统加载文件。
标签: javascript jquery json highcharts highmaps