Hello, I'm trying to get the user to click on a button, open a SWAL containing another button that has an ajax function, but neither does SWAL open.
$(document).ready(function(){
var encerrar = $('#encerrar');
$('input').on('click', function () {
encerrar();
})
swal({
title: "Tem certeza?",
text: "Realmente quer encerrar o atendimento?",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Sim",
closeOnConfirm: false
}, function encerrar()
{
$.ajax({
type: "POST",
url: "../Back/encerrar.php",
success: function(data){
}
}).
done(function(data) {
swal("Canceled!", "Your order was successfully canceled!", "success");
$('#orders-history').load(document.URL + ' #orders-history');
})
.error(function(data) {
swal("Oops", "We couldn't connect to the server!", "error");
});
});
}