add error handling to various ajax operations