I'm using jQuery's .load() to replace a div on my page with a table from a php file. I'm using the callback function to run another function that modifies the data that was just loaded, but it is running the function before it has loaded the table, causing the function to do nothing.
Is there a way I can force the callback to run after it has loaded? I'm having the .load() run every 10 seconds, so I can't just tell it to wait.
Here is what I'm trying to do:
function fixSelected(){
$.each(selected, function(index, value) {
document.getElementById(value).innerHTML = '-';
});
}
function refreshTable() {
$('#tablefill').load('table.php', function(){
fixSelected();
});
}
The variable selected
is an array containing the IDs of a few buttons on the table that is being loaded.