function excluiraluno(id){
decisao = confirm('Deseja deletar?');
if(decisao){
$.ajax({
url: "EditaExcluiAluno.php",
dataType: "html",
type: "POST",
data: { id: id},
success: function(data){
$('#painelAbas').html(data);
},
});
}
}
I want to put this swal inside this function but I can not do it
<!DOCTYPE html>
<html>
<head>
<link data-require="sweet-alert@*" data-semver="0.4.2" rel="stylesheet" href="sweetalert.min.css" />
<script src="sweetalert.min.js"></script>
<link rel="stylesheet" type="text/css" href="styleExcluir.css">
</head>
<body>
<form id="from1">
<button>Excluir</button>
</form>
<script>
document.querySelector('#from1').addEventListener('submit', function(e) {
var form = this;
e.preventDefault();
swal({
title: "Deseja Excluir?",
icon: "warning",
buttons: [
'Cancelar',
'Excluir'
],
dangerMode: true,
}).then(function(isConfirm) {
if (isConfirm) {
swal({
title: 'Excluido com Sucesso!',
timer: 2000,
icon: 'success'
}).then(function() {
form.submit();
});
} else {
swal("Cancelado com Sucesso", "", "success");
}
});
});
</script>
</body>
</html>