Returning error details in AJAX when duplicate operation