1
如何使用sweetalert進行沒有確認按鈕的Ajax調用,但仍顯示加載gif?基本上我希望在Ajax調用運行時顯示加載gif。開箱即用的解決方案要求您在Ajax調用之前啓用確認按鈕。Sweet Alert - 沒有確認按鈕的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");
});
});
https://limonte.github.io/sweetalert2/#ajax-request –