Add ajax loading and error handlers