I have this code for validation but it show error even it returns true. I change all return false to true but error is shown. 
second I want show result.message instead "username is already taken". 

```
    $.validator.addMethod("uniqueUserName", function (value, element) {
        $.ajax({
            type: "post",
            url: "/validation/search",
            data: {
                nationalCode: $('#karkonan_MelliCode').val(),
                personType: $('#karkonan_MelliatCode').val()
            },
            dataType: "json",
            async: false,
            success: function (result) {
               // alert(result.message);
               // alert(result.resultCode);
                // if the user exists, it returns a string "true"
                if (result.resultCode == "0") {
                    alert($('#karkonan_MelliatCode').val());// already exists
                    //j = result.message;// already exists
                    return false;
                }
                else {
                    alert($('#karkonan_MelliatCode').val());
                    return true;      // username is free to use
                }
            },
            error: function (result) {
                // if the user exists, it returns a string "true"
                alert("error");
                return false;
                // username is free to use
            }
        })
    }, "Username is Already Taken");

```

and it's rule is :

```
'karkonan.MelliCode': {
                        number:true,
                        minlength: 10,
                        maxlength: 10,
                        required: true,
                        withmelliat:true,
                        uniqueUserName: true
                    },

```