您好,登录后才能下订单哦!
密码登录
登录注册
点击 登录注册 即表示同意《亿速云用户服务条款》
这里是控制器里返回的
/**
* @param pageUtil 分页工具类
* @param cliCorpQuery 查询类
* @param model model
* @return String
*/
@RequestMapping(value = {"/list"}, method = RequestMethod.GET)
public String list(PageUtil<CliCorp> pageUtil, CliCorpQuery cliCorpQuery, Model model) {
PageUtil<CliCorp> corps;
try {
corps = corpClientService.queryByPage(pageUtil, cliCorpQuery);
} catch (Exception e) {
logger.error("queryByPage error:" + e.getMessage());
return "queryByPage error";
}
model.addAttribute("corps", corps);
return VIEW_PATH + "list";
}
页面
<tr th:each="corp:${corps.contents}">
<td><span th:text="${corp.name}"></span></td>
<td><span th:text="${corp.creditCode}"></span></td>
<td><span th:text="${corp.taxNo}"></span></td>
<td><span th:text="${corp.showName}"></span></td>
<td><span th:text="${corp.bank}"></span></td>
<td><span th:text="${corp.bankAccount}"></span></td>
<td><span th:text="${corp.agent}"></span></td>
<td><span th:text="${corp.address}"></span></td>
<td><span th:text="${corp.status}"></span></td>
<td><span th:text="${corp.creator}"></span></td>
<td>
<button type="button" th:onclick="'javascript:check('+${corp.id}+',2)'">审核
</button>
<button type="button" th:onclick="'javascript:check('+${corp.id}+',3)'">拒绝
</button>
</td>
</tr>
JS
function check(id, status) {
$.ajax({
type: "POST",
data: {id: id, status: status},
url: "/admin/corp/check",
success: function (data) {
if (data == "认证成功") {
window.location.href = ("/admin/corp/list");
} else {
alert("认证失败");
}
},
error: function (data) {
alert("认证失败");
}
});
}
以上所述是小编给大家介绍的Spring boot + thymeleaf 后端直接给onclick函数赋值的实现代码,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对亿速云网站的支持!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。