AJAX API endpoints for views

Implements #28