title: Making a notification system using jQuery and Ajax
body: <p>I need to build a notification system, based on jQuery and Ajax, I have put together some PHP code to display JSON like this:</p>
  
  <pre><code>{ "msg_new": "1", "note_new": "2", "frd_new": "2", "frd_link": "" }
  </code></pre>
  
  <p>How can I load this 'notification' to <code>&lt;span&gt;&lt;/span&gt;</code> tags using jQuery and <code>setInterval</code>? I am a little bit confused, can anyone please help me out?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Currently, this is the code I've attempted to use, but it doesn't seem to work:</p>
  
  <pre><code>&lt;span id="new_msgs"&gt;&lt;/span&gt;
  &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script&gt;
      function get_new() {
          $.getJSON("update_new.php", function(data) {
              $('#new_msgs').html(data["msg_new"]);
          });
      }
  
      setInterval(get_new, 1000);
  &lt;/script&gt;
  </code></pre>