Add a controller for AJAX requests

Signed-off-by: Gawain Lynch <gawain.lynch@gmail.com>