- gt:great than(大于)>
- ge:great equal(大于等于)>=
- eq:equal(等于)==
- lt:less than(小于)<
- le:less equal(小于等于)<=
- ne:not equal(不等于)!=
ajax傳回json:
@RequestMapping("/toUpdate")
@ResponseBody
public UserInfor toUpdate(String id, Model model) {
UserInfor userInfor = userInforRepostitory.findById(id).get();
model.addAttribute("user", userInfor);
return userInfor;
}
前台ajax接收并指派模态框:
<script type="text/javascript">
function cz(id){
/* alert(id); */
/* console.log(id); */
$.ajax({
url: "/toUpdate",
data: "id="+id,
type: "post",
dataType:"json",
success: function (data) {
console.log(data.id);
$("#userName").val(data.userName);
}
});
}
</script>
點選事件傳值:
原因
3.x版本的thymeleaf為了防止注入攻擊,更新了安全機制。
解決
修改前:
<button th:οnclick="'javascript:del(this,\''+${quartzInfo.id}+'\');'" type="button"></button>
修改後:
<button th:data-id="${quartzInfo.id}" οnclick="del(this,this.getAttribute('data-id'))" type="button"></button>
轉載于:https://my.oschina.net/u/3942108/blog/2993431