I have a $.getJSON() function set up like this.
var colNames = [];
$.getJSON(reqURL, function(data) {
$.each(data.rows, function(key,val){
var colName = val.column_name;
colNames.push(colName);
});
console.log(colNames);
}));
console.log(colNames);
The console.log() outside the $.getJSON() function fires first, meaning colNames never gets filled.
What must I change so that colNames gets filled?