zoukankan      html  css  js  c++  java
  • 函数封装多个不同按钮的点击事件

     1     function btnGroup_fn1(taskId, proInstanceId, textContent, requestUrl) {
     2         layer.confirm('确定' + textContent + '任务吗?', function (index) {
     3             $.ajax({
     4                 url: requestUrl,
     5                 data: {
     6                     taskId: taskId,
     7                     processId: proInstanceId
     8                 },
     9                 type: 'POST',
    10                 dataType: 'json',
    11                 success: function (data) {
    12                     if (data != null) {
    13                         var divHtml = "<div><p>" + textContent + "</p>" +
    14                             "<p>" + data.msg + '心跳异常' + "</p>" +
    15                             "</div>"
    16                         layer.msg(divHtml, {time: 3000})
    17                         freshCurrentTable(freshCurrentTableUrl)
    18                     }
    19                 },
    20                 error: function () {
    21                 }
    22             });
    23             layer.closeAll();
    24         });
    25     }

    使用:

    1   // 开始
    2                     $('#start_btn').off().on('click', function (e) {
    3                         layui.stope(e)
    4                         var taskId = this.getAttribute('data-taskid');
    5                         var proInstanceId = this.getAttribute('data-proId');
    6                         var textContent = '开始';
    7                         var requestUrl = '/proMg/continue.afca';
    8                         btnGroup_fn(taskId, proInstanceId, textContent, requestUrl);
    9                     });
  • 相关阅读:
    window.open
    GetPostBackClientHyperlink
    引发和使用事件
    浅谈宝宝的教育及培养
    C#关键字之:base、this
    Ioc
    自定义input[type="radio"]的样式
    选择_冒泡_直接插入排序.md
    Tkinter.md
    从零开始学wordpress 之一
  • 原文地址:https://www.cnblogs.com/yangguoe/p/9267490.html
Copyright © 2011-2022 走看看