I made this function:
function menucount(bartype, div){
$(document).ready(function(){
$.ajax({
url: 'ajax.php',
data:"opdate-menu="+bartype+"&bar=<?php echo $barnavn ?>",
success: function(data) {
$('#'+div).html(data);
}
});
});
}
It checks for updates and displays a new number in my menu-buttons. I use it like this:
window.setInterval(menucount(), 2000);
This works.
Now I want to run this function on more buttons, so I create a 'wrapper' function and try to run it like this:
function wrapper(){
menucount('manglerprint','printvip');
menucount('manglerprint_plus','printvipplus');
menucount('temp_vipplus','ansvipplus');
menucount('temp_vipalm','ansvip');
}
window.setInterval(wrapper(), 2000);
But this doesnt work, It only runs one of the menucount()
instances. How could I run menucount()
many times like this?