added ajax functionality for chats