一区二区三区在线-一区二区三区亚洲视频-一区二区三区亚洲-一区二区三区午夜-一区二区三区四区在线视频-一区二区三区四区在线免费观看

服務(wù)器之家:專注于服務(wù)器技術(shù)及軟件下載分享
分類導(dǎo)航

PHP教程|ASP.NET教程|Java教程|ASP教程|編程技術(shù)|正則表達(dá)式|C/C++|IOS|C#|Swift|Android|VB|R語(yǔ)言|JavaScript|易語(yǔ)言|vb.net|

服務(wù)器之家 - 編程語(yǔ)言 - Java教程 - Spring boot + thymeleaf 后端直接給onclick函數(shù)賦值的實(shí)現(xiàn)代碼

Spring boot + thymeleaf 后端直接給onclick函數(shù)賦值的實(shí)現(xiàn)代碼

2020-11-22 22:53十年面壁 Java教程

這篇文章主要介紹了Spring boot + thymeleaf 后端直接給onclick函數(shù)賦值的實(shí)現(xiàn)代碼,需要的朋友可以參考下

 這里是控制器里返回的 

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/**
 * @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è)面

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<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

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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ì)大家有所幫助,如果大家有任何疑問請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)服務(wù)器之家網(wǎng)站的支持!

原文鏈接:http://blog.csdn.net/gongzhao426177/article/details/73550155

延伸 · 閱讀

精彩推薦
主站蜘蛛池模板: 日本在线一区二区 | 动态图啪啪120秒免费看 | 久久日本片精品AAAAA国产 | 奶大逼紧 | 精品麻豆国产 | 国产精品手机视频一区二区 | 国产精品永久免费视频观看 | 被强迫调教的高辣小说 | 狠狠婷婷综合缴情亚洲 | 日本韩国一区二区三区 | 久久国产精品永久免费网站 | 青草园网站在线观看 | 99久久免费国产特黄 | 亚洲性综合网 | 91噜噜噜噜色 | 亚洲天堂男人 | 免费在线观看日本 | 久久er国产精品免费观看2 | 大胸美女被c | 四虎影院久久久 | 91成人免费视频 | 国产福利不卡视频在免费 | 欧美亚洲国产精品久久第一页 | 亚洲国产精品婷婷久久久久 | 男女污网站 | 出轨娇妻的呻吟1—9 | 国产99在线a视频 | 欧美整片完整片视频在线 | 免费一级生活片 | 亚洲第一综合网站 | 涩涩五月天| 国产精品区牛牛影院 | 日韩性大片免费 | 色噜噜亚洲男人的天堂www | gay男强壮军人chinese | 91国内精品线免费播放 | 国产精品免费小视频 | 免费在线视频成人 | 手机在线观看国产精选免费 | 天海翼三级 | 我强进了老师身体在线观看 |