【发布时间】:2020-12-20 13:17:09
【问题描述】:
这里有人如何修复我的通知?我想显示通知完全完成,然后重新加载页面。目前,我的通知快速退出并且没有完全显示。我正在使用 ajax 和 toastr。非常感谢你们!非常感谢您的帮助。这是我尝试过的:
function InsertOrUpdateExpense() {
var data = $('#formExpenseTransaction').serialize();
$.ajax({
type : 'POST',
url : url + 'InsertOrUpdateExpenseTransaction',
data : data,
dataType : 'json',
beforeSend:function() {
$('#btn-expense--transaction').html(' <i class="icon-spinner2 spinner"></i>').attr('disabled',true);
},
success:function(data) {
data.success === true ? notify(data.type,data.message) : notify(data.type,data.message);
var content = data.type == 'info' ? 'Save Changes' : 'Add Expense';
$('#btn-expense--transaction').html(content +' <i class="icon-arrow-right14 position-right"></i>').attr('disabled',false);
setTimeout(function() {
location.reload();
}, 3000);
}
});
}
function notify(type,message) {
Command: toastr[type](message)
}
function toastr_option() {
toastr.options = {
"newestOnTop": true, "progressBar": false, "positionClass": "toast-top-right", "preventDuplicates": true, "showDuration": 300, "hideDuration": 1000, "timeOut": 5000, "extendedTimeOut": 1000, "showEasing": "swing", "hideEasing": "linear", "showMethod": "slideDown", "hideMethod": "slideUp"
}
}
【问题讨论】:
标签: javascript jquery ajax toastr