Username ajax w/ jquery validation (JSON syntax issue)

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
cohq82
Forum Commoner
Posts: 43
Joined: Mon Apr 21, 2008 8:38 pm

Username ajax w/ jquery validation (JSON syntax issue)

Post by cohq82 »

Hi all,

I am using code below to call the /Account/CheckUserExist to check if #userData_Username is existed, then it will return TRUE.
'userData.Username': {
required: true,
minlength: 2,
remote: {
type: "GET",
async: false,
url: "/Account/CheckUserExist",
data: {
userName: function() {
return $("#userData_Username").val();
}
}
}
},

However, I need the return to be FALSE at "remote" when userName existed. The reason is that if username is existed, remote=true and it will pass validation. What can I do to reverse the boolean value in "remote"?

Any good advise on how to solve this username validation problem? I know it is classic.

Thanks
Post Reply