$("#addProductForm")
.validate(
{
debug : true,
rules : {
proName : {
required : true
},
proIntro : {
required : true
}
},
messages : {
proName : {
required : '<fmt:message key="exposition.product.encode.error.required" />'
},
proIntro : {
required : '<fmt:message key="exposition.product.encode.error.required" />'
}
}
});
$("#saveExpoProduct").bind('click', function() {
var flag = $("#addProductForm").valid();
if (!flag) {
//alert("没有通过验证");
return;
}
//alert('saveExpoProduct click');
$.ajax({
url : "${saveExpoProduct }",
type : "POST",
dataType : "json",
data : {
eid : $("#eid").val(),
eNo : $("#eNo").val(),
proName : $("#proName").val(),
proIntro : $("#proIntro").html(),
picPath : $("#picPath").val()
},
success : function(data) {
var obj = data;
if (obj.status == 'SUCCESS') {
alert("添加成功!");
} else {
alert("添加失败!");
}
},
error : function(xhr) {
// request error
alert("request error!");
}
});
});