您好,登錄后才能下訂單哦!
這里是控制器里返回的
/** * @param pageUtil 分頁(yè)工具類 * @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"; }
頁(yè)面
<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 == "認(rèn)證成功") { window.location.href = ("/admin/corp/list"); } else { alert("認(rèn)證失敗"); } }, error: function (data) { alert("認(rèn)證失敗"); } }); }
以上所述是小編給大家介紹的Spring boot + thymeleaf 后端直接給onclick函數(shù)賦值的實(shí)現(xiàn)代碼,希望對(duì)大家有所幫助,如果大家有任何疑問(wèn)請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)億速云網(wǎng)站的支持!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。