Hello, i have this:
$counter = $sWall + $sWC + $sOther;
if (!empty($counter)) {
echo '(' . $counter . ')';
$counter = 0;
}
And js:
$(window).blur(function() {
tracktime = new Date();
setInterval(function() {
$.ajax({
type: "POST",
url: "imback.php",
data: {
mode: 'ajax',
getUpdates: 'auto',
},
success: function(msg){
document.title = msg + document.title;
}
});
}, 2000);
})
For showing new unread comments in the title bar. Works fine and displays it as (1), although everytime it call, it adds a (1) so the title gets like this: (1)(1)(1)(1)(1)(1)(1)(1).......
And i only want it to do it once (1) no matter how many calls, so if a new call is response is (2) then it will show (2) and not (2)(1)(1)....
How can i fix this the best way?