setInterval(function(){ $.get("updates.php", {}, function(results){ if ($(results).length) { $("results").each(function(){ // do something with update messages }); } }); }, 30000); // Every 30 seconds.