Updating chat.js with ajax form submission.

Also updated chat.c to return a message if update fails after the update
attempt.