$.metadata.setType("attr", "vld");
成都创新互联不只是一家网站建设的网络公司;我们对营销、技术、服务都有自己独特见解,公司采取“创意+综合+营销”一体化的方式为您提供更专业的服务!我们经历的每一步也许不一定是最完美的,但每一步都有值得深思的意义。我们珍视每一份信任,关注我们的成都网站建设、成都网站设计质量和服务品质,在得到用户满意的同时,也能得到同行业的专业认可,能够为行业创新发展助力。未来将继续专注于技术创新,服务升级,满足企业一站式营销型网站建设需求,让再小的高端网站设计也能产生价值!
$.validator.addMethod("username", function(value) {
var p = /^[0-9a-zA-Z\u4e00-\u9fa5\.\-@_]+$/;
return p.exec(value) ? true : false;
}, "Please enter only letters,digits,chinese and '_','-','@'");
$.metadata.setType("attr", "vld");
$.validator.addMethod("username", function(value) {
var p = /^[0-9a-zA-Z\u4e00-\u9fa5\.\-@_]+$/;
return p.exec(value) ? true : false;
}, "只能输入字母、数字、中文和'_','-','@'符号");
jQuery.validator.addMethod("isMobile", function(value,element) {
var length = value.length;
var mobile = /^(0|86|17951)?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$/;
return this.optional(element) || mobile.test(value);
}, "请正确填写您的手机号码");
jQuery.validator.addMethod("isTel", function(value,element) {
var length = value.length;
var tel = /^((0\d{2,3})-)(\d{7,8})(-(\d{3,}))?$/;
return this.optional(element) || tel.test(value);
}, "请正确填写您的固定电话号码");
jQuery.validator.addMethod("isPhone", function(value,element) {
var length = value.length;
var mobile = /^(0|86|17951)?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$/;
var tel = /^((0\d{2,3})-)(\d{7,8})(-(\d{3,}))?$/;
return this.optional(element) || (tel.test(value) || mobile.test(value));
}, "请正确填写您的联系电话");
jQuery.validator.addMethod("isIdCardNo", function(value,element) {
var length = value.length;
//***正则表达式(15位)
var isIDCard1=/^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{2}(\d|X|x)$/;
//***正则表达式(18位)
var isIDCard2=/^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}(\d|X|x)$/;
return this.optional(element) || (isIDCard1.test(value) || isIDCard2.test(value));
}, "请正确填写您的***号码");
jQuery.validator.addMethod("isZipCode", function(value,element) {
var length = value.length;
var zipCode = /^[1-9]{1}(\d+){5}$/;
return this.optional(element) || zipCode.test(value);
}, "请正确填写您的邮政编码");
jQuery.validator.addMethod("isEmail", function (value, element) {
var mail = /^[a-z0-9._%-]+@([a-z0-9-]+\.)+[a-z]{2,4}$/;
return this.optional(element) || (mail.test(value));
}, "邮箱格式不对");
$("#VipApply_AddForm").validate({
submitHandler: function(form) { //通过之后回调
$.post("${base}/addVipApply.jspx",
$('#VipApply_AddForm').serialize(),
function(data){
if(data.status==0){
alert("VIP申请已提交,请耐心等待审核结果!");
location.href='${base}/hymsa/';
}else if(data.status==1) {
alert("验证码错误");
$("#vipApplyCaptcha").click();
}
},'json');
},
invalidHandler: function(form, validator) { //不通过回调
return false;
}
});
});
@RequestMapping(value = "**/addVipApply.jspx")
public void addVipApply(VipApplyEntity entity,String captcha, HttpServletRequest request,HttpServletResponse response, ModelMap model) throws JSONException {
JSONObject json = new JSONObject();
try {
this.vipApplyService.save(entity);
json.put("status", 0);
} catch (Exception e) {
json.put("status", 1);
e.printStackTrace();
}
ResponseUtils.renderJson(response, json.toString());
}