Backbone models

Continuing from #303, this moves the ajax requests out of the view classes and into a bunch of model classes.

The only change I had to make on the PHP side of AJAX so far is to return the raw data as JSON and render the template on the client side.