added a ajax error handler.

sometimes errors occur on the client side. because of the
ajax.complete() callback is not fired the loading indicator does not
disappear and the ui feels like the request runs endless, even if it
already terminated with an error.