I'm trying to declare a global array so I can use the array in another function:
columnArray = new Array();
But for some reason it's not global I see the array in the function I created it in, but not outside that function. Here's my full code:
//Get column header variables
jQuery.ajax({
url: 'myJsonFile.json',
async: true,
dataType: 'json',
error: function(result) {
console.log("There was an error loading the json.");
},
success: function(data) {
columnArray = new Array ();
var i;
for(i = 0; i < data.columnVars.length; i++)
{
columnArray[i] = data.columnVars[i].vars;
}
}
});