$(document).ready(function() { //setInterval('check_pm();', 60000); }); function check_pm(){ $.ajax({type: "POST",url: "/inc/pm_check.php", data: "ajax=1", success: function(msg){ var d=msg.split('|'); if (d[0]=='1') { $('#header_inbox_bar').html(d[1]); }else{ $('.badge-important').remove(); } } }); }