title: Memory leak in jQuery AJAX calls
body: <p>I've written a little chat-box widget which runs an ajax call every second, to fetch new messages that have been posted. The problem is it's leaking memory, and after only about 15 mins of being open it crashes my browser (Firefox).</p>
  
  <p>It's probably me, as I am a relative newbie, and I'm sure I've missed something out or am not unsetting my variables, etc.. </p>
  
  <pre><code>var chat = {}
  chat.fetchMessages = function() {
      $.ajax({
          url: '/chat_ajax.php',
          type: 'post',
          data: { method: 'fetch'},
          success : function(data) {
              $('#chat .messages').html(data);
              $("#chat").scrollTop($("#chat")[0].scrollHeight);
          }
      });
  }
  chat.interval = setInterval(chat.fetchMessages, 1000);
  chat.fetchMessages();
  </code></pre>
  
  <p>Can someone please glance at my (basic) code, and see if you can spot where the memory leak is occuring, and what I'm doing wrong? Do I need to unset some variables or something?</p>
  
  <p>Many thanks!</p>