<link rel="stylesheet" type="text/css" href="http://192.168.2.40/Always_Fresh_Backend/backend/bower_components/sweetalert/css/sweetalert.css">
<script type="text/javascript" src="http://192.168.2.40/Always_Fresh_Backend/backend/bower_components/sweetalert/js/sweetalert.min.js"></script>
function sweetalert() {
swal({
title: "Are you sure?",
text: "msg",
type: "warning",
showCancelButton: true,
confirmButtonClass: "btn-danger",
confirmButtonText: "Yes",
closeOnConfirm: false
},
function(isConfirm){
if (isConfirm) {
$.ajax({
url: "<?=BASEURL;?>/method/post/<?= $data['id'] ?>",
type: "GET",
beforeSend: function(){
},
complete: function(){
},
success: function (response) {
}
});
} else {
}
function sweetalert() {
swal({
title: "Are you sure?",
text: "msg",
type: "warning",
showCancelButton: true,
confirmButtonClass: "btn-danger",
confirmButtonText: "Yes",
closeOnConfirm: false
},
function(isConfirm){
if (isConfirm) {
$.ajax({
url: "link",
type: "GET",
beforeSend: function(){
},
complete: function(){
},
success: function (response) {
}
});
} else {
}
});
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-sweetalert/1.0.1/sweetalert.min.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-sweetalert/1.0.1/sweetalert.min.js"></script>
<a href="#" class="badge badge-danger float-right ml-1" onclick='return sweetalert();'>hapus</a>