【发布时间】:2016-05-06 06:43:42
【问题描述】:
正常的 ajax 实时进度条是这样加载的,
$.ajax({
xhr: function() {
var xhr = new window.XMLHttpRequest();
xhr.upload.addEventListener("progress", function(e) {
var pro = (e.loaded / e.total) * 100;
$('.progress-bar-anim').css('width', pro + '%').attr('aria-valuenow', pro);
}, false);
return xhr;
},
type: "POST",
dataType: 'json',
url: "data.php",
data: {"username": username, "password": password},
success: function(msg) {
if (msg.status == 'success') {
window.location = "dashboard.php"
} else {
hide_progress();
}
}
});
我想在收到服务器响应的同时在 jquery 数据表 中加载实时进度条。我应该怎么做?
【问题讨论】:
标签: javascript jquery ajax datatables jqxhr