jquery.validateのajax方式は検証しました.
2894 ワード
ウェブサイトを作る時、jquery.validateプラグインajax方式を使って原始パスワードが正しいかどうかを検証して、研究しました.ブログ園の友達の助けを加えて、ついに実現しました.コードを貼り付ける
記事のソース:http://www.cnblogs.com/laihuayan/p/3916050.html
参考文献:http://zhidao.baidu.com/link?url=0BxF0QvTywzuRkLUFj6ulUQKYqp97CjUOZBV1UUmXoCkS9HNyOT2axHkcOsRLi-x 22 u 1 ZFIdmITB-lzKWZVehq
記事のソース:http://www.cnblogs.com/laihuayan/p/3916050.html
<script type="text/javascript">
$(function () {
$("#form1").validate({
rules: {
pwd: {
required: true,
remote: {<span style="color:#ff0000;">//validate ajax "remote:"</span>
url: "@Url.Action("ValidatePwd", "UserInfo")",// , url
type: "post",
dataType: "json",
data:{
pwd: function () {
return $("#pwd").val(); //
}<span style="color:#cc0000;">// , "," </span>
},
dataFilter: function (data) { <span style="color:#ff0000;">// </span>
if (data == "true") {
return true;
}
else {
return false;
}
}
}</span>
},
password: {
required: true,
rangelength: [6, 16]
},
confirm_password: {
required: true,
rangelength: [6, 16],
equalTo: "#password"
}
},
messages: {
pwd: {
required: " !",
remote: " , !" <span style="color:#cc0000;"> // , , 。</span>
},
password: {
required: " ",
minlength: jQuery.format(" 6-12 !")
},
confirm_password: {
required: " !",
minlength: " 6-16 ( 、 、 ) !",
equalTo: " !"
}
},
onfocus: true,
onkeyup: false, // , 。
onsubmit: false
});
==================================================================================================================================================================================参考文献:http://zhidao.baidu.com/link?url=0BxF0QvTywzuRkLUFj6ulUQKYqp97CjUOZBV1UUmXoCkS9HNyOT2axHkcOsRLi-x 22 u 1 ZFIdmITB-lzKWZVehq