bootstrapValidator中用ajax校验

xlh : {
                validators : {
                    trigger : 'change',
                    notEmpty : {
                        message : '序列号不能为空'
                    },
                    threshold : 15,// 有15字符以上才发送ajax请求
                    remote : {// ajax验证。server result:{"valid",true or false}
                        url : appPath + "/app/chanpin/check/",
                        message : '该条形码已经存在',
                        delay : 500,// ajax刷新的时间是1秒一次
                        type : 'POST',
                        // 自定义提交数据,默认值提交当前input value
                        data : function(validator) {
                            return {
                                userName : $("input[name=userName]").val(),
                                method : "checkUserName"// 判断调用方法关键字。
                            };
                        }
                    }
                }
            }
原文地址:https://www.cnblogs.com/huiy/p/12804713.html