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

服務(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

延伸 · 閱讀

精彩推薦
主站蜘蛛池模板: 色老妈 | 亚洲第一永久色 | 爱情岛论坛亚洲一号路线 | 欧美日韩国产一区二区三区在线观看 | 天天做日日做 | 午夜一级免费视频 | 男人边吃奶边做好爽视频免费 | gay男男白袜chinese | 国产成人愉拍精品 | 强行扒开美女大腿挺进 | 亚洲AV午夜精品麻豆AV | 四虎4hu永久免费国产精品 | 成人免费国产欧美日韩你懂的 | juliaann厨房大战 | 天堂中文在线观看 | 女女宿舍互慰h文小说 | 精品国偷自产在线 | 无人在线视频高清免费观看动漫 | 喘息揉弄1v1h老师 | 久久久久久免费高清电影 | 色老大在线 | 风间由美在线播放 | 美女跪式抽搐gif动态图 | 精品综合久久久久久88小说 | 日韩精品欧美 | 亚洲国产韩国欧美在线不卡 | 和日本免费不卡在线v | tube69中国露脸 | 国产精品久久久久久久牛牛 | 亚洲国产精品综合久久一线 | 四虎精品成人免费观看 | 亚洲成色爱我久久 | 黄动漫车车好快的车车a | 亚洲123区 | 暖暖的韩国免费观看 | 四虎在线最新永久免费 | 国产精品亚洲片在线va | 国产大秀视频一区二区三区 | 亚洲日韩中文字幕一区 | chinese男gay飞机同志 | 久久久91精品国产一区二区 |