javascript在调用回调之前同步运行一个方法

javascript在调用回调之前同步运行一个方法,javascript,jquery,bootstrap-table,Javascript,Jquery,Bootstrap Table,我试图显示一个微调器元素,同时引导表每10秒自动刷新一次,但我遇到的问题是,它不会同步运行,并在显示微调器后立即关闭微调器 一如既往地感谢您的帮助 呼叫代码 setInterval(function () { $('#refreshing-running').show(); refreshRunningTable(function() { $('#refreshing-running').hide(500); }); }, 10000); 刷新方法 f

我试图显示一个微调器元素,同时引导表每10秒自动刷新一次,但我遇到的问题是,它不会同步运行,并在显示微调器后立即关闭微调器

一如既往地感谢您的帮助

呼叫代码

setInterval(function () {

    $('#refreshing-running').show();
    refreshRunningTable(function() {
        $('#refreshing-running').hide(500);
    });
}, 10000);
刷新方法

function refreshRunningTable(callback) {
    $('#running-table').bootstrapTable('refresh', { silent: true }); // this line needs to be synchronous and not callback until complete..
    callback();
}
初始表格设置,如果有帮助

function loadTable() {
    $('#running-table')
        .bootstrapTable({
            method: 'get',
            url: '/.../...',
            striped: false,
            pagination: true,
            detailView: true,
            detailFormatter: rowDetailFormatter,
            pageSize: 5,
            pageList: [4, 8, 16],
            search: false,
            showRefresh: false,
            onResetView: function () { bindDeleteButtons() },
            columns: [
                { width: '', field: 'a', title: 'a', sortable: true, formatter: aFormatter },
                { width: '', field: 'b', title: 'b', sortable: true },
                { width: '', field: 'c', title: 'c', sortable: true },
                { width: '', field: 'd', title: 'd', sortable: true }
            ]
        });
}