adding error handler to ajax calls on index page