jQuery Validate 中的 remote
来源:互联网 发布:阿里云备份恢复要多久 编辑:程序博客网 时间:2024/06/06 05:34
首先需要返回一个只存在 true 或 false 的json数据
/// <summary> /// 判断手机号是否已存在 /// </summary> /// <param name="mobile"></param> /// <returns></returns> public JsonResult IsExitMobile(string mobile) { var res = new JsonResult(); var bol = godService.IsExitMobile(mobile); res.Data = !bol; res.JsonRequestBehavior = JsonRequestBehavior.AllowGet; return res; }
前台js代码
<script type="text/javascript"> //基本信息验证 $("#Godform").validate({ rules: { Aliases: { required: true, rangelength: [2, 20], remote: "@Url.Action("IsExitAliases", "UserInfo")" }, PassWord: { required: true, rangelength: [6, 20], }, ConfirmPwd: { required: true, rangelength: [6, 20], equalTo: "#PassWord" }, Email: { email: true }, Mobile: { required: true, mobile: true, remote: "@Url.Action("IsExitMobile", "UserInfo")" }, Code: { required: true } }, messages: { Aliases: { required: "请输入昵称", remote:jQuery.format("昵称已经被注册"), rangelength: jQuery.format("昵称长度应在{0}至{1}个字之间"), }, PassWord: { required: "请输入密码", rangelength: jQuery.format("密码长度应在{0}至{1}个字之间") }, ConfirmPwd: { required: "请输入确认密码", rangelength: jQuery.format("密码长度应在{0}至{1}个字之间"), equalTo: "两次输入密码不一致" }, Mobile: { required: "请输入手机号", remote:"手机号已被使用" }, Code: { required: "请输入您收到的验证码" } }, ignore: "", //错误标签样式 errorClass: "error-text", //设置错误信息存放标签 errorElement: "span", //设置验证触发事件 focusInvalid: true, submitHandler: function () { if (!$("#Agree").attr("checked")) { $.jBox.confirm("必须同意 @Configs.GetSiteName()的服务条款和隐私规则才能提交注册!", "温馨提示"); return false; } $.cookie('_USERNAME', $("#Mobile").val(), { path: "/", expires: 30 }); this.submit(); } }); </script>
0 0
- jQuery Validate 中的 remote
- jQuery validate之remote
- jquery validate remote 返回错误
- jquery validate 的remote用法
- Jquery validate之remote用法
- Jquery validate 用法以及remote
- jquery.validate remote 和 自定义验证方法
- jquery.validate.js remote 数据远程验证
- jQuery.Validate -- remote 多参数传递
- jquery.validate.js的remote用法
- Jquery插件validate的remote的用法
- jquery.validate remote 和 自定义验证方法
- jquery.validate remote 和 自定义验证方法
- jquery.validate remote 和 自定义验证方法
- jquery.validate.js的remote用法
- jquery.validate remote 和 自定义验证方法
- jquery.validate 校验 remote返回值
- jquery.validate remote 和 自定义验证方法
- Android Studio系列教程一--下载与安装
- 将Excel文件转换为Html
- Linux 指令详解 df 检查文件系统的磁盘空间使用情况
- 设计模式实践六-接口隔离原则
- Linux的信号处理
- jQuery Validate 中的 remote
- 模板方法模式
- hg 验证失败
- 当oracle clob类型不能和group by并用,但是需要去除多列重复
- sublime text3及其插件的安装
- Android 学习资料
- IOS mysql/Java服务端对emoji表情的支持
- 一种TextView插入图片的途径(图片的显示高度和文字高度一致)
- Tomcat使用心得