title: Notification Message using PHP and Jquery
body: <p>In the header of my application I have notification message icon.</p>
  
  <p>For example, when a new record is inserted into the table, there must appear the notification message to admin, like this:</p>
  
  <p><a href="https://i.stack.imgur.com/djCTD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/djCTD.png" alt="image1"></a></p>
  
  <p>If I toggle the button it looks like this:</p>
  
  <p><a href="https://i.stack.imgur.com/07MQP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/07MQP.png" alt="enter image description here"></a></p>
  
  <p>But the problem is that when I click the notification button, it shows the data, but the count of notofications does not reset to zero.</p>
  
  <p>What I need is when I click the notification link, the quantity of notifications should be reset to zero.</p>
  
  <p>it should look like below image</p>
  
  <p><a href="https://i.stack.imgur.com/f7i4O.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/f7i4O.png" alt="image3"></a></p>
  
  <p>This is my code:</p>
  
  <pre><code>&lt;!-- Messages: style can be found in dropdown.less--&gt;
                  &lt;li class="dropdown messages-menu"&gt;
                      &lt;a href="#" class="dropdown-toggle" data-toggle="dropdown" id="notify-comet"&gt;
                          &lt;i class="fa fa-envelope-o"&gt;&lt;/i&gt;
                          &lt;span class="label label-success" id="not-count"&gt;
                              &lt;?php
                                  $count = Delay::find()
                                          -&gt;where(('id') !== 0)
                                          -&gt;orderBy('id')
                                          -&gt;count();  
                                  echo "$count";
                              ?&gt;
                          &lt;/span&gt;
                      &lt;/a&gt;
                      &lt;ul class="dropdown-menu"&gt;
                          &lt;li class="header"&gt;You have &lt;?php echo "$count" ?&gt; messages&lt;/li&gt;
                          &lt;?php
                              $qry = Delay::find()-&gt;all();
                              foreach ($qry as $key =&gt; $value) 
                              { 
                          ?&gt;
                              &lt;div class="delay-notification"&gt;
                              &lt;ul class="menu"&gt;
                                  &lt;li&gt;&lt;a href="index.php?r=delay"&gt;&lt;?php echo $value-&gt;claimer_name; ?&gt; &amp;nbsp &lt;?php echo $value-&gt;company_name; ?&gt;&lt;/a&gt;&lt;/li&gt;
                              &lt;/ul&gt;
                              &lt;/div&gt;
                          &lt;?php  
                              $i = 1;
                              if ($i++ == 4) break;
                              }
                          ?&gt;
  
                          &lt;li class="footer"&gt;&lt;a href="index.php?r=delay"&gt;See All Messages&lt;/a&gt;&lt;/li&gt;
                      &lt;/ul&gt;
                  &lt;/li&gt;
  
                  &lt;?php
                      }
                  ?&gt;
  </code></pre>