Hello i’m tryng to make an alert using thse sweet alert linrary : http://t4t5.github.io/sweetalert/
i have tryed to integrate the code for making an a confirmation alert for deleting an item, but when i click on the button for deleting the item these not work.
Hope you help me, thank you.
CODE BEFORE INTEGRATING SWEET ALERT:
$(".delete-link").click(function()
{
var id = $(this).attr("id");
var del_id = id;
var parent = $(this).parent("td").parent("tr");
if(confirm('Sure to Delete ID no = ' +del_id))
{
$.post('delete.php', {'del_id':del_id}, function(data)
{
parent.fadeOut('slow');
});
}
return false;
});
CODE AFTER INTEGRATING SWEET ALERT:
$(".delete-link").click(function() {
var id = $(this).attr("id");
var del_id = id;
var parent = $(this).parent("td").parent("tr");
});
swal({
title: "Are you sure you want to delete?",
text: "Sure to Delete ID no = " + del_id,
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes",
closeOnConfirm: false
},
function(){
$.post('delete.php', {'del_id':del_id}, function(data)
{
parent.fadeOut('slow');
});
});
return false;
});