I am reading in a JSON data file from dropbox using
var data=[];
var dropbox_url="
https://dl.dropboxusercontent.com/s/nuib29y6ney74lf/toy_popularity_data.json?dl=1";
d3.json(dropbox_url, function(error, json){
if(error) {return console.warn(error);};
data=json;
console.log("Successfully loaded file from Dropbox!");
});
however the data does not then seem to be available outside the function?
if I put an alert(data.length) inside the function it gives the correct value of 3199; if outside the function it is 0?