finish ajax code for check duplicated