博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
$("#form1").validate({
            rules: {
                ctl00$ContentPlaceHolder1$txtShopName: {
                    remote: {
                        type: "post",
                        url: "/Tools/submit_ajax.ashx?action=validate_shopname",
                        data: {
                            name: function () {
                                return $("#ContentPlaceHolder1_txtShopName").val();
                            }
                        },
                        dataType: "html",
                        dataFilter: function (data, type) {
                            if (data == "true") {
                                return false;
                            } else {
                                return true;
                            }
                        }
                    }
                }
            },
            messages: {
                ctl00$ContentPlaceHolder1$txtShopName: {
                    remote: "该店铺名已存在!"
                }
            },
            errorElement: "span",
            success: function (label) { label.text(" ").addClass("success"); } //正确时的样式
        });

 

posted on 2014-07-03 10:41    阅读(217)  评论(0编辑  收藏  举报