Closed countryroadgraphics closed 7 years ago
sweetalert2.js?ver=6.2.3:1383 Uncaught (in promise) TypeError: Cannot set property 'className' of undefined at sweetalert2.js?ver=6.2.3:1383 at modalDependant (sweetalert2.js?ver=6.2.3:958) at sweetAlert (sweetalert2.js?ver=6.2.3:1545)
This appears to happen as soon as the second SWAL call is made after the first promise is resolved via ajax.
Just tried in a fiddle and appeared to work. Will check if there is a conflict with other scripts.
As a side note, the second SWAL does load and display the info, however the .then() function never fires for it.
reopen with jsfiddle if needed
Add the sweet alert in a timeout:
}).then(function(scan){
setTimeout(()=> {
swal({
title: "Is this correct?",
allowOutsideClick: false,
showCancelButton: true,
confirmButtonText: 'Correct!',
html: '<p> ' +
'Provider: ' + scan.wholesaler + '<br>' +
'Name: ' + scan.name + '<br>' +
'Reference: ' + scan.reference + '<br>' +
'</p>',
});
}, 200);
}).catch(swal.noop);
Getting this error when calling SWAL inside .then() after an ajax call. Using v 6.2.3.
Here's the code in question