This error will show when i click "cancel" button in 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"
});
}
});
when click close icon, it show error too,
uncaught exception: close
Should be posted here: https://limonte.github.io/sweetalert2/
In case someone comes here and gets stuck (because sweetalert != sweetalert2
!)
At the end of the swal({...})
, add this: .catch(() => swal.close())
Every promise function needs a failure callback.
@eminx you saved my day :)
@eminx me too!!
Most helpful comment
In case someone comes here and gets stuck (because
sweetalert != sweetalert2
!)At the end of the
swal({...})
, add this:.catch(() => swal.close())
Every promise function needs a failure callback.