setInterval not working for ajax call -
i have getjson call webservice , works fine, i'm trying make request every 10 sec. using setinterval callback function fire alert pop up. can't make work. here's code:
function ajxcall(){ $.getjson('http://api.tubeupdates.com/?method=get.status&lines=all&return=name,status,messages,status_starts&jsonp=?', function (result){ $.each(result.response.lines, function(i, item){ $('#status').append("<p>"+item.name + " - " + item.status + " <br><b>" +item.messages + "</b> " + item.status_starts + "</p>"); }); }); } setinterval(ajxcall(), (10 * 1000), function(){ alert('called!') });
what doing wrong?
thanks in advance,
mauro
setinterval(function() { ajxcall(); }, 10000);
try that
Comments
Post a Comment