title: AJAX Chat Scrollbar down
body: <p>The scroll bar doesn't go down on the Chat Page, so what I need to do is I want it to go away when people send messages between themselves but the scrollbar doesn't scroll down when the other person sends the message.</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;div class="messages" id="messages" style="overflow:auto"&gt;
    &lt;div class="message" id="message"&gt;Yükleniyor...&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <pre class="lang-js prettyprint-override"><code>chat.fetchMessages = function() {
    $.ajax({
      url: 'chat.asp',
      type: 'post',
      data: {
        method: 'fetch'
      },
      success: function(data) {
        $('#messages').html(data);
        $("#messages")[0].scrollHeight - $("#messages").scrollTop() == $("#messages").outerHeight()
      }
    });
  }
  </code></pre>
  
  <pre class="lang-css prettyprint-override"><code>.messages {
    border: 1px solid #red;
    height: 450px;
    overflow-y: auto;
  }
  </code></pre>