I can’t figure out why its says ajaxcall() doesn’t exist, but the works just fine
$('button').click(function(){
ajaxcall();
});
var nameid = 1;
$(document).ready(function(){
$('button').click(function(){
ajaxcall();
});
function ajaxcall(){
$.get('mysqlquery.php?id='+nameid, function(data){
$('#loadbox').append(data+' ');
});
nameid++;
}
setInterval("ajaxcall",1000);
});
Please help me understand why, I think it has to do with scope But I’m stumped. (may be time for a break)
Define the function outside of
document.ready, and use the overload ofsetIntervalthat takes a function reference: