The Section()
is responsible to look on database and get any HTML code if some things are matched. If nothing matched, there is no callback (but I can callback an empty thing).
Then it calls addIt()
and display the HTML. Works fine.
My question is when there is some HTML to get from database, to stop the timer? Because for now it adds HTML every 10 seconds.
function addIt(data) { $(data).insertAfter('#hello'); }
setInterval(function Section(){
$.getJSON("domain"+ number, addIt);
}, 10000);