ajax-y magic

Theoretically this should allow the chat to be more chat-like and not require a page refresh.
Someday I will stop writing SQL queries like it's not 2003.