javascript - prevent .click to run when page reloads -


i created notification on page , post data if status equal 0 update 1 after display.

so happens on notif badge shows how many data being post.

and numbers removed on badge if clicked notif icon..

but problem encounter numbers disappears when reload/refresh page..

here code..

setinterval(function () {           $.ajax({             type: 'post',             url:'functions/get_newtest.php',             datatype:'json',             success: function (data) {              (var = 0; < data.length; i++) {                 $('#dropdown_notif').append('<li><a href="#">'+data[i].userfullname+' '+data[i].message+' '+'from'+' '+data[i].page_from+'</a></li>');                 $('#nt_count').html(($('#nt_count').html()) ? parseint($('#nt_count').html()) + 1 : 1);                 console.log($('#nt_count'));             }                 if(data.length){                  $.ajax({                     url:'functions/update_test.php',                     type:'post',                     datatype:'json',                     data:{id:data[0].id},                     success: function(data){                         console.log(data);                     }                 });             }              },             error: function (status) {                 console.log(status.responsetext);             }           });         },10000); 

and here button function use remove numbers when clicked.

$('li.dropdown a:has("#nt_count")').click(function () {               $(this).find('span.notification').html(null);            }); 

is there way not disappear numbers on badge when page reloads?.cause wanted numbers removed if clicked..


Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -