JQ event didnt active on the extract row sort by datatable.js

后端 未结 2 1924
隐瞒了意图╮
隐瞒了意图╮ 2021-01-26 03:57

I\'m using DataTable.js to showing the data and I have some

提交评论

  • 2021-01-26 04:22

    ok i fixed the event inactive on other row
    but these an other probleme is the event are duplicate

    [old]

      $("select[name='type']").change(function(){
                  var type_req = $(this).val();
    
                  var id = $(this).closest('tr').find('td#id_commande').html();
                  var action ="update";
                  var action_infos = "type_req";
    
                  console.log("change event active");
                  console.log(type_req);
                  console.log(id);
    
                  $.ajax({
                    type: "POST",
                    url: "../controllers/commandeController.private.php",
                    data:{id:id ,action : action ,action_infos : action_infos ,type : type_req},
                    success:function(){toastr.success("Modification commande réussi")},
                    error:function(){toastr.error("Modification commande impossible")},
                  });
    
                });
    

    [new]

    $('table[name="commandeTable"]').on("click",function(){
    
    
                $("select[name='type']").change(function(){
                  var type_req = $(this).val();
    
                  var id = $(this).closest('tr').find('td#id_commande').html();
                  var action ="update";
                  var action_infos = "type_req";
    
                  console.log("change event active");
                  console.log(type_req);
                  console.log(id);
    
                  $.ajax({
                    type: "POST",
                    url: "../controllers/commandeController.private.php",
                    data:{id:id ,action : action ,action_infos : action_infos ,type : type_req},
                    success:function(){toastr.success("Modification commande réussi")},
                    error:function(){toastr.error("Modification commande impossible")},
                  });
    
                });
              });
    
    0 讨论(0)
  • 提交回复
    热议问题