I have a JSON array stored in a file data.json - I used the code that was recommended here for a similar problem, explain why when I try to access the array later in the program it tells me it is undefined.
var chartData = (function () {
var chartData = null;
$.ajax({
'async': false,
'global': false,
'url': "data.json",
'dataType': "json",
'success': function (data) {
chartData = data;
}
});
return chartData;
})();
Help appreciated!
Edit; For accessing, I'm using the array as a series in dojo-chart: http://dojotoolkit.org/grids-charts
After I attempt to initialize var chartData, the only other point I use it is in:
chart.addSeries("Name",chartData);
Edit #2; In case it matters the data.json file is formatted like:
[#, #, #, ... , #]