Use ajax callbacks

Now we're using ajax, we can add listeners to error responses.