Add error handler for ajax call