Error handler for ajax call

The error handler was missing so I added one