Este error aparecerá cuando haga clic en el botón "cancelar" en Sweetalert2
swal({
title: menu_title,
text: title,
input: "text",
showCancelButton: true,
animation: "slide-from-top",
showLoaderOnConfirm: true,
inputPlaceholder: lang.write_your_comment,
preConfirm: function(inputValue) {
return new Promise(function(resolve, reject) {
resolve('ok');
});
})
},
allowOutsideClick: false
}).then(function(result){
var res = $.parseJSON(result);
if(res.status){
swal({
title: lang.thankyou+"!",
text: lang.your_feedback_sent,
type: "success"
}).then(function(confirm){
location.reload();
});
} else{
swal({
title: lang.sorry+"!",
text: res.message,
type: "warning"
});
}
});
al hacer clic en el icono de cierre, también muestra un error,
excepción no detectada: cerrar
Debería publicarse aquí: https://limonte.github.io/sweetalert2/
En caso de que alguien venga aquí y se atasque (¡porque sweetalert != sweetalert2
!)
Al final de swal({...})
, agregue esto: .catch(() => swal.close())
Cada función de promesa necesita una devolución de llamada de falla.
@eminx me salvaste el día :)
@eminx yo también !!
Comentario más útil
En caso de que alguien venga aquí y se atasque (¡porque
sweetalert != sweetalert2
!)Al final de
swal({...})
, agregue esto:.catch(() => swal.close())
Cada función de promesa necesita una devolución de llamada de falla.