I want to add timer after callback another function in Sweetalert2.
In the example just add timer when swal
run.
this is basic code :
swal({
title: 'alert!',
text: 'I need this close after my function',
})
and below is ajax
and I need the swal
close in second
after ajax
success
$.ajax({
dataType: "json",
url: url,
type: "GET",
data: {some: data},
success: function (json) {
if (json.status === 'OK') {
swal({
timer:2000
});
}
}
});
but when ajax
success, new modal of swal()
opened with timer, not close the current swal()