Solution
$('#test1_id').on('click',function(e) {
var getNameAttr = $(this).attr("name");
console.log(getNameAttr);
event.preventDefault();
var form = $(this).parents('form');
swal({
title: "Are you sure?",
text: "All data related to this AMC ID will be parmanently deleted",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes",
cancelButtonText: "No, cancel please!",
closeOnConfirm: false,
closeOnCancel: false
},
function(isConfirm){
if (isConfirm) {
form.submit();
} else {
swal("Cancelled", "ha :)", "error");
}
});
});
$('#test2_id').on('click',function(e) {
var getNameAttr = $(this).attr("name");
console.log(getNameAttr);
event.preventDefault();
var form = $(this).parents('form');
swal({
title: "Are you sure?",
text: "TEST2",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes",
cancelButtonText: "No, cancel please!",
closeOnConfirm: false,
closeOnCancel: false
},
function(isConfirm){
if (isConfirm) {
form.submit();
} else {
swal("Cancelled", "ha :)", "error");
}
});
});