I need to use a function several times and wanted to avoid writing the same method over and over. I wanted to use $.getJSON() response and store it in a var that will be returned. That way I can just call the method.
function startFilter(){
            var grid = [];
            $.getJSON('data/gridData1.json',function(json){
                grid = json;
                console.log(grid);
            });
            console.log(grid);
            return grid;
        }
the grid var is set inside of the .getJSON but not outside of .getJSON. any ideas why, and if more info is needed let me know?
 
     
    