i am trying to do pop up delete action with sweetalert2 in asp.net core project
it seems delete befor the pop up it self
but not working
JS:
jQueryAjaxDelete = form => {
swal({
title: "Are you sure to delete this of ?",
text: "Delete Confirmation?",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Delete",
closeOnConfirm: false
}).then((confirm) => {
if (confirm('Are you sure to delete this record ?'))
$.ajax({
type: 'POST',
url: form.action,
data: new FormData(form),
contentType: false,
processData: false,
success: function (res) {
$('#view-all').html(res.html);
},
error: function (err) {
console.log(err)
}
})
});
};
in view
<form asp-action="Delete" asp-route-id="@item.Id" onsubmit="return jQueryAjaxDelete(this)" class="d-inline">
<input type="hidden" asp-for="@item.Id" />
<input type="submit" value="Supprimer" class="btn btn-danger" />
</form>
i got this proplem https://i.ibb.co/64sZ2YX/Capture.png