我正在一个项目上,我想在删除帐户之前发出警报,我的问题是即使我单击“取消”,该帐户还是会被删除,请帮帮我。这是代码的一部分
<script>
swal({
title: 'Êtes-vous sûr de vouloir supprimer ce compte?',
text: 'You will not be able to recover this imaginary file!',
type: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Oui',
cancelButtonText: 'Non',
confirmButtonClass: 'confirm-class',
cancelButtonClass: 'cancel-class',
closeOnConfirm: false,
closeOnCancel: false
},
function(isConfirm) {
if (!isConfirm)
{
window.location.href="AdminPlatform.jsp";
}
else {
swal(
'Deleted!',
'Your file has been deleted.',
'success'
) ;
<% int id=Integer.parseInt(request.getParameter("id"));
ConnectionAdmin.delete(id);
%>
}
});
const swalWithBootstrapButtons = Swal.mixin({
customClass: {
confirmButton: 'btn btn-success',
cancelButton: 'btn btn-danger'
},
buttonsStyling: false,
})
</script>