title: Check if new message was added AJAX
body: <p>I'm trying to achieve sth like a facebook notifications '(1)' in the tab title.
  Below is a simplified code of my future's site message box - what I want to do is to use AJAX to check if the new message was added (new tr), but without refreshing the site, and then show expected number in tab title.
  Here is my code so far - but I have to refresh the site after adding a new table row...</p>
  
  <pre><code>&lt;body&gt;
      &lt;div id="container"&gt;
          &lt;div id="tab"&gt;
              &lt;table id="tabl"&gt;
                  &lt;tr&gt;
                      &lt;th&gt;ID&lt;/th&gt;
                      &lt;th&gt;Name&lt;/th&gt;
                      &lt;th&gt;Message&lt;/th&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;1&lt;/td&gt;
                      &lt;td&gt;John&lt;/td&gt;
                      &lt;td&gt;Hey! What's up!&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;2&lt;/td&gt;
                      &lt;td&gt;Kylie&lt;/td&gt;
                      &lt;td&gt;Are you there Kylie?&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;3&lt;/td&gt;
                      &lt;td&gt;Peter&lt;/td&gt;
                      &lt;td&gt;Please, buy me a milk&lt;/td&gt;
                  &lt;/tr&gt;                    
              &lt;/table&gt;
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;script&gt;
          var count = document.getElementById('tabl').rows.length - 1;
          var x = new XMLHttpRequest();
          var i = 0;
          x.onreadystatechange = function() {
              if (x.readyState == 4 &amp;&amp; x.status == 200) {
                  document.title = '(' + count + ')' + ' ' + document.title;
              }
          };
          x.open('GET', 'http://localhost/php13/notif.php', true);
          x.send();
      &lt;/script&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>How to achieve that without refreshing the site ?</p>