lots of stuff, ajax success and failure handlers, client code