我对bootbox.js模态有问题。
正在执行并等待响应就绪状态更改为3,模型将显示
但是,在请求完成且就绪状态更改为4后,readystate 4
正在console.log中打印,但模型不会隐藏。
var dialog = bootbox.dialog({
message: '<p class="text-center mb-0"><i class="fa fa-spin fa-cog"></i> Please wait while we do something...</p>',
className: 'bounceInUp animated',
closeButton: false,
show: false
});
// ready stat with jquery
var _orgAjax = jQuery.ajaxSettings.xhr;
jQuery.ajaxSettings.xhr = function () {
var xhr = _orgAjax();
xhr.onreadystatechange = function() {
console.log(xhr.readyState);
var state = xhr.readyState;
if (state == 3 ) {
dialog.modal('show');
console.log('readystate 3 ');
}else if (state == 4) {
dialog.modal('hide');
console.log('readystate 4 ');
};
}
return xhr;
};
答案 0 :(得分:0)