add ajax error handler (resolves #3)