Ajax for validation and toggle grade fields