Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $('#dataunitkerja').on('click', '.hapus', function (){
- var Id = $(this).data('Id');
- swal.fire({
- title : 'Konfirmasi',
- text : 'Anda ingin menghapus',
- type : 'error',
- showCancelButton : true,
- confirmButtonText : 'Hapus',
- confirmButtonColor : '#d33',
- cancelButtonColor : '#3085d6',
- cancelButtonText : 'Tidak',
- reverseButtons : true
- }).then((result) => {
- if(result.value){
- $.ajax({
- url : "<?= site_url('unitkerja/hapusunitkerja') ?>",
- method : "post",
- beforeSend : function(){
- swal.fire({
- title : 'Menunggu',
- html : 'Memproses Data',
- onOpen : () => {
- swal.showLoading()
- }
- })
- },
- data:{Id:Id},
- success : function(data){
- swal.fire({
- type : 'success',
- title : 'Data Dihapus',
- text : 'Anda Berhasil Hapus Data',
- timer : 2000,
- })
- dataunitkerja.ajax.reload(null, false)
- }
- })
- }else if (result.dismiss === swal.DismissReason.cancel){
- swal.fire({
- type : 'warning',
- title : 'Batal',
- text : 'Anda Membatalkan',
- timer : 2000,
- })
- }
- })
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement