Javascript jquery数据表:加载实时进度条

Javascript jquery数据表:加载实时进度条,javascript,jquery,ajax,datatables,jqxhr,Javascript,Jquery,Ajax,Datatables,Jqxhr,普通的ajax实时进度条加载方式如下: $.ajax({ xhr: function() { var xhr = new window.XMLHttpRequest(); xhr.upload.addEventListener("progress", function(e) { var pro = (e.loaded / e.total) * 100;

普通的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 datatables中加载实时进度条。我应该如何操作?

使用成功方法创建表:

function getData() {
    $.ajax({
      url : 'example.com',
      type: 'GET',
      success : handleData
    })
}

function handleData(data) {
    table = $('#table').DataTable( {
            "data": data,
            ....
}