jamboljack

JS hapusData

Nov 19th, 2018
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.05 KB | None | 0 0
  1. function hapusData(username) {
  2.     var id = "'"+username+"'";
  3.     swal({
  4.         title: 'Anda Yakin ?',
  5.         text: 'Data ini akan di Hapus !',
  6.         type: 'warning',
  7.         showCancelButton: true,
  8.         confirmButtonColor: '#3085d6',
  9.         cancelButtonColor: '#d33',
  10.         confirmButtonText: 'Yes',
  11.         cancelButtonText: 'No',
  12.         closeOnConfirm: true
  13.     }, function(isConfirm) {
  14.         if (!isConfirm) return;
  15.         $.ajax({
  16.             url : "<?=site_url('panel/users/deletedata')?>/"+id,
  17.             type: "POST",
  18.             dataType: "JSON",
  19.             success: function(data) {
  20.                 swal({
  21.                     title:"Sukses",
  22.                     text: "Hapus Data Sukses",
  23.                     showConfirmButton: false,
  24.                     type: "success",
  25.                     timer: 2000
  26.                 });
  27.                 reload_table();
  28.             },
  29.             error: function (jqXHR, textStatus, errorThrown) {
  30.                 alert('Error Hapus Data');
  31.             }
  32.         });
  33.     });
  34. }
Add Comment
Please, Sign In to add comment