如何在sweetAlert中实现Ajax调用而无需确认按钮,但仍要显示加载gif?基本上,我希望在Ajax调用运行时显示一个加载gif。开箱即用的解决方案要求您在进行Ajax调用之前启用确认按钮。
以下显然不起作用:
window.swal({
title: "Checking...",
text: "Please wait",
imageUrl: "images/ajaxloader.gif",
showConfirmButton: false,
allowOutsideClick: false
},
function () {
$.getJSON('myurl').done(function (data) {
swal("", "Good job!", "success");
}).fail(function (jqXHR, textStatus, err) {
swal("", "An error occurred", "error");
});
});