I have the following code which retrieves the variable hf using getJSON
$.getJSON('../scripts/json.php', function(json) {
var user_function = json.hf;
});
I have the following auto_refresh function
// Refresh dashboard stats
var auto_refresh = setInterval(function(){
$('#today').load('index.php #today');
$('#_7days').load('index.php #_7days');
$('#_30days').load('index.php #_30days');
$('#allTime').load('index.php #allTime');
$('#sidebar').load('../' + user_function + '/index.php #sidemenu', function() {
$('#sidebar li:not(.complete)').each(function () {
if($('a', this).attr('href') == document.URL) {
$(this).toggleClass('inactive active');
}
});
});
}, 20000);
I want to pass the variable user_function from the getJSON call to the auto_refresh, but keep getting back 'undefined'
index.phponce and usefindto extract the relevant elements.