Advertisement
Thelz

toastr

Jan 22nd, 2020
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script>
  2.         $(function(){
  3.             $(".btnDelete").on('click',function(){
  4.                 event.preventDefault();
  5.  
  6.                 var nama = $(this).parent().parent().children()[2];
  7.                 nama = $(nama).html();
  8.                 var tr = $(this).parent().parent();
  9.  
  10.                 $(".modal").modal('show');
  11.                 $(".modal-title").html("Konfirmasi");
  12.                 $(".modal-body").html("Anda Yakin Ingin Menghapus <b>"+nama+"</b> ?");
  13.  
  14.                 var href = $(this).attr('href');
  15.  
  16.                 $(".btnYa").off();
  17.                 $(".btnYa").on('click',function(){
  18.                     $.ajax({
  19.                         'url' : href,
  20.                         'type' : 'POST',
  21.                         'success' : function(result){
  22.                             if(result == 1){
  23.                                 $('.modal').modal('hide');
  24.                                 tr.fadeOut();
  25.  
  26.                                 toastr.success("Data Berhasil Dihapus");
  27.                             }
  28.                         }
  29.                     });
  30.                 });
  31.             });
  32.         });
  33. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement