You have to put the next call of fetchMessage in the callback of the previous one :
var chat = {}
chat.fetchMessages = function () {
$.ajax({
url: 'ajax/ajax/chat.php',
type: 'POST',
data: { method: 'fetch' },
success: function(data) {
$('#chats').html(data);
chat.fetchMessages(); // let's do it again
}
});
}
chat.fetchMessages(); // first call