1

I am using this code - Jfiddle link to create a datamap of the United States. I would like to modify the data set in the example by using a file stored locally.

The data appears to be stored in a file located at: http://www.highcharts.com/samples/data/us-population-density.json.

I changed the filename in to be a local drive, but the chart won't load. What changes do I need to make?

Reference to my local drive:

$.getJSON('http://www.highcharts.com/samples/data/jsonp.php?filename=C:/us-population-density.json&callback=?', function (data) {

user2242044
  • 8,803
  • 25
  • 97
  • 164
  • You can't load files from drive using AJAX (at least not in Chrome). See [this question](http://stackoverflow.com/questions/6923707/using-ajax-to-read-local-files) or [this one](http://stackoverflow.com/questions/17947971/ajax-in-jquery-does-not-work-from-local-file) and many others.. – Paweł Fus Oct 22 '14 at 11:17
  • Not true. http://www.highcharts.com/docs/working-with-data/preprocessing-data-from-a-file-csv-xml-json – Fergus Nov 30 '14 at 00:14
  • You need to have any webserver to load data, because browsers block loading files from filesystem. – Sebastian Bochan Dec 01 '14 at 10:06

1 Answers1

0

try:

 $.getJSON('us-population-density.json', function(data) {

According to to highcharts reference

Fergus
  • 2,821
  • 2
  • 27
  • 41