我正在使用甜蜜警报,但如果 ajax 的请求完成,我想让它自动关闭
swal({
title: "Are you sure?",
text: "You are choosing order by custom search",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Confirm",
closeOnConfirm: false,
timer: **AUTO WITH AJAX??**
},
Run Code Online (Sandbox Code Playgroud)
我正在添加一个变量
var dones = $(document).ajaxComplete(function(){
swal.close()
});
Run Code Online (Sandbox Code Playgroud)
并像这样制作 swal
swal({
title: "Are you sure?",
text: "You are choosing order by custom search",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Confirm",
**timer: dones,**
closeOnConfirm: false
},
Run Code Online (Sandbox Code Playgroud)
但仍然不像我预期的那样