给自己留着看,ajax前台判断,如果没写,注意是" "和undefined
<script type="text/javascript">
$("#enfilter").val("${wsProductPage.enfilter}");
function allCodeQuery(){
var code=$('#code').val();
if(code == "" || code == undefined){
alert("请填写产品编码");
}
$.ajax({
type : 'POST',
url : "wsProductController.do?allCodeChoose",
data : {code:code},
dataType : "json",
success : function(data) {
$('#allcode').val(data.obj);
if(!data.success){
alert("没有查到该产品对应的集团编码,默认为产品编码");
}
},
error: function() {// 请求失败处理函数
alert("执行异常");
}
});
}
</script>