我在我的项目中运行上传数据,当数据加载到数据库中时,我希望关闭 sweetalert。这是我的 sweetalert 代码:
document.getElementById('subImport').click();
$(document).ready(function() {
setTimeout(function() {
let timerInterval
Swal.fire({
text:'Data Sedang Didownload!',
allowOutsideClick:false,
background:'',
timer: 120000,
timerProgressBar: true,
didOpen: () => {
Swal.showLoading()
const b = Swal.getHtmlContainer().querySelector('b')
},
willClose: () => {
clearInterval(timerInterval)
}
}).then((result) => {
/* Read more about handling dismissals below */
if (result.dismiss === Swal.DismissReason.timer) {
console.log('Data Sedang didownload')
}
})
e.preventDefault();
$.ajax({
contentType: false,
processData: false,
success: function(data) {
setTimeout(function() {
swal.close()
document.getElementById('subTampil').click();
setTimeout(function() {
document.getElementById("coba").hidden = true;
document.getElementById("divSupp").hidden = false;
document.getElementById("divMember").hidden = true;
document.getElementById("divItem").hidden = true;
}, 100)
}, 120100)
},
});
}, 100)
})
我已经修改了我的计时器代码,但它不起作用。最上面是我最近的代码。我想要甜蜜的警报是 dinamis,而不是像上面那样(我的尺寸数据统计)