0
Hello, I’m trying to get after the user click on a button, open a SWAL containing another button that has an ajax function, however, not even the SWAL opens.
$(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");
});
});
}
The error remains
– Tales Rodrigues
checks in your browser console, if clicking "Yes" appears any error. Post this error here!
– Romario Pires
That’s the point, no SWAL appears! I click on the button (appeared) and nothing happens at all
– Tales Rodrigues
Dude you didn’t call the SWAL, try this: https://jsfiddle.net/n45wvL4d/
– Romario Pires
Nothing even didn’t work on jsfiddle
– Tales Rodrigues
You should only copy the HTML, there is no way to run there because there is no way to run an external library there.
– Romario Pires