前端定义一个input 通过th:value 拿到值, 然后我想通过文本框的 name 进行数据查询
点击按钮 根据 name 的条件要求查询多条数据
<input type="text" name="zdid" id="az_zdid" required="required" th:value="*{zdid}"
style="width: 180px; height: 25px;margin-top: 6px; background-color:transparent;border:0;">
<button type="submit" id="btn3" onclick="anniuxx()"
style="border-bottom: none;width: 80px">操作记录</button>
controller 如何改变才能获取到zdid ,
@RequestMapping(value = "/jilucahxun")
@ResponseBody
public List jiluchaxun(){
List<ZD_jilu> zcList=zhongDuanService.jiluchaxun();
return zcList;
js
function anniuxx(){
div1.style.display="none";
div2.style.display="none";
div3.style.display="block";
document.getElementById("btn2").style.backgroundColor = "white";
document.getElementById("btn1").style.backgroundColor = "white";
document.getElementById("btn3").style.backgroundColor = "blue";
$.ajax({
url:"/zd/jilucahxun",
method:"POST",
dataType:"json",
success :function(data){
$("#xiangjilu").html("");
$("#xiangjilu").append("<tr ><td style='border:2px solid #2D93CA;width: 10%;text-align: center;font-weight: bold'>操作用户</td>" +
"<td style='border:2px solid #2D93CA;width: 20%;text-align: center;font-weight: bold'>操作时间</td>" +
"<td style='border:2px solid #2D93CA;width: 10%;text-align: center;font-weight: bold'>操作类型</td>" +
"<td style='border:2px solid #2D93CA;width: 13%;text-align: center;font-weight: bold'>依据或原因</td>" +
"<td style='border:2px solid #2D93CA;width: 40%;text-align: center;font-weight: bold'>原因或备注</td></tr>");
alert(JSON.stringify(data));
$.each(data,function (i,n) {
$("#xiangjilu").append("<tr><td style='padding-top: 0.3%;padding-bottom: 0.3%;text-align: center;border-bottom:3px dashed #93D1FF'>"+n.dengji_yonghu+"</td>" +
"<td style='padding-top: 0.3%;padding-bottom: 0.3%;text-align: center;border-bottom:3px dashed #93D1FF'>"+n.dengji_date+"</td>" +
"<td style='padding-top: 0.3%;padding-bottom: 0.3%;text-align: center;border-bottom:3px dashed #93D1FF'>"+n.caozuo_state+"</td>" +
"<td style='padding-top: 0.3%;padding-bottom: 0.3%;text-align: center;border-bottom:3px dashed #93D1FF'>"+n.zdid+"</td>" +
"<td style='padding-top: 0.3%;padding-bottom: 0.3%;border-bottom:3px dashed #93D1FF'>"+n.remarks+"</td></tr>")
});
}
})
}