javascript - Global access to array values made from Json -


$.getjson("sluzba.json", function(result){     array = $.each(result, function(value){         return value;     });   tablemaker(array); }); 

this code, want have access array outside scope of function.

is possible?

please help...

yes, possible. can using callback method.

function myfunction(callback){     $.getjson("sluzba.json", function(result){     array = $.each(result, function(value){        return value;     });     callback(array);     tablemaker(array);     }); } myfunction(function(myarray){    console.log(myarray); }); 

Comments

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -