2017-09-11 2 views
-2

ich zum Löschen einer ZeileBrauchen Wert zurückgeben von SweetAlert für confirm eine Aktion löschen

<a href="<?php echo base_url('sekertaris_controller/f1_delete/'); echo $row->kode_f1;?>" onclick="return dialog()"><button class="btn btn-danger btn-sm"><i class="fa fa-trash"></i></button></a> 

und mit Hilfe von JavaScript-Dialog() für Trigger-Link über eine Taste

<script> 
    function dialog() { 
     swal({ 
      title: 'Are you sure?', 
      text: "You won't be able to revert this!", 
      type: 'warning', 
      showCancelButton: true, 
      confirmButtonColor: '#3085d6', 
      cancelButtonColor: '#d33', 
      confirmButtonText: 'Yes, delete it!' 
     }).then(function() { 
      swal(
       'Deleted!', 
       'Your file has been deleted.', 
       'success' 
      ) 

     }); 

    } 
</script> 

das Problem SweetAlert geschlossen und Daten in der Zeile ohne Bestätigung gelöscht

Antwort

0
function dialog() { 
    swal({ 
     title: 'Are you sure?', 
     text: "You won't be able to revert this!", 
     type: 'warning', 
     showCancelButton: true, 
     confirmButtonColor: '#3085d6', 
     cancelButtonColor: '#d33', 
     confirmButtonText: 'Yes, delete it!' 
     cancelButtonText: 'Cancel', 
     closeOnConfirm: false, 
     closeOnCancel: false 
    }, function (isConfirm) { 
     if (isConfirm) { 
      swal("Deleted!", "Your imaginary file has been deleted.", "success"); 
     } else { 
      swal("Cancelled", "Your imaginary file is safe :)", "error"); 
     } 
    }); 
}