ajax-y magic

Theoretically this should allow the chat to be more chat-like and not require a page refresh.
In other news, this is great work! Once you put the connection in functions, I'll merge the request. A+.