function check() {//js
var text = document.getElementById("xh").value;//id
if (text == "") {
alert("");//
return false;//false
}
if (!(/(^[1-9]\d*$)/.test(text))) {
alert("");//
return false;//false
}
var student_id = $("input[name="student_id"]").val();
$.post("<%=basePath%>user/queryByUser",
{ student_id : student_id }).done(function(data) {
console.log(data.result);
if (data == null || data == "") {
console.log("");
alert("");
return false;
} else {
console.log("");
}
}).fail(function() {
console.error("");
});
return true;//
}
</script>
<body>
<div class="listDIV">
<table id="FileTable" border="1" width="50%" height="50%"
style="text-align: center;">
<form action="<%=basePath%>user/one" method="post">
<input type="text" id="xh" name="student_id" placeholder="">
<button class="glyphicon glyphicon-select" onclick="return check();"></button>
</form>
abort the submission of the form when it is judged to be empty