我想在回調函數後添加另一個函數Sweetalert2。 在示例中,只需在swal
運行時添加計時器。如何在sweetalert2打開後添加計時器?
這是基本的代碼:
swal({
title: 'alert!',
text: 'I need this close after my function',
})
及以下ajax
和我需要的swal
接近second
後ajax
成功
$.ajax({
dataType: "json",
url: url,
type: "GET",
data: {some: data},
success: function (json) {
if (json.status === 'OK') {
swal({
timer:2000
});
}
}
});
但當ajax
成功,定時開的swal()
新模式,不接近目前swal()
提供的代碼行你寫 –
我與代碼 – mylastof
ofcourse完成,它會因爲你再次使用SwaI位()函數 –