I'm using sweet alert, but i want make it close automatically if the request of ajax is completed
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??**
},
I am adding a variable
var dones = $(document).ajaxComplete(function(){
swal.close()
});
and make swal like this
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
},
but still not like I expected
I recommend you to use SweetAlert2 - the supported fork of original SweetAlert.
What you looking for is
onOpen
parameter and.showLoading()
method, here's your task:PS. notice that SweetAlert2 is a little bit different from SweetAlert, check the simple migration guide: https://github.com/sweetalert2/sweetalert2/wiki/Migration-from-SweetAlert-to-SweetAlert2