Added client side json control, and fixed a CSRF error introduced during unit testing