Added AJAX to fetch messages