1. Using the bootstrapValidator check name, you need to return a string such as {"valid": true} to view the data. I would like to ask why this is wrong. No matter what name you enter, the foreground will prompt you that the user name does not exist
this is the background code
[ActionName ("ValidName")]
[AuthorFilter]
public ActionResult ValidName(string NAME)
{
T_Project bll = new T_Project();
OnlineEntity.Model.T_Project[] projectList = bll.getListByName(NAME);
bool notExit = false;
if (projectList != null && projectList.Length > 0)
{
notExit = true;
}
return Json("{\"valid\":"+notExit+"}", JsonRequestBehavior.AllowGet);
}
name: {
validators: {
notEmpty: { message: "" },
stringLength: {
min: 4,
max: 50,
message: "4-50"
},
regexp: {
regexp: /^[\u4e00-\u9fa5A-Za-z]{1,20}$/
},
remote: {
type: "POST",
url: "/Project/Project/ValidName",
data:function(validator) {
var x_={
userName: validator.getFieldElements("name").val()
};
return x_;
},
message: "",
delay: 2000
}
}
}