Ajax加载数据加载中遮罩

Ajax加载数据加载中遮罩

js方法,beforeSend内进行调用遮罩显示

$.ajax({
    url: '${request.contextPath}/statistical/getData',
    type: 'post',
    data: 'columnID=' + $("#ColumnValue").val() + '&deptID=' + $("#DeptValue").val(),
    timeout: 15000,
    beforeSend: function (XMLHttpRequest) {
        $("#loading").css('display', 'block');
    },
    success: function (data, status) {
        $("#loading").css('display', 'none');
        if ("${SearchType}".indexOf("year") >= 0) {
            $("#statistics-time").text("统计日期:" + layDate_start.substring(0, 7) + "~" + layDate_end.substring(0, 7));
        } else {
            $("#statistics-time").text("统计日期:" + layDate_start + "~" + layDate_end);
        }
        creatGrid(eval(ColNamesData), eval(ColModelData), eval(data));
    },
    complete: function (XMLHttpRequest, status) {
        $("#loading").css('display', 'none');
    },
    error: function (XMLHttpRequest, status, errorThrown) {
        $("#loading").css('display', 'none');
    }
});
<div class="loading" id="loading" style="display:none;">
    <div style="position:absolute; left:50%; top:50%; z-index:9999; text-align:center; margin-left:-50px; margin-top:-30px;">
        <img src="${request.contextPath}/assets/image/loading.gif"/>
        <div style="color: #ffffff;;">正在查询...请稍等</div>
    </div>
</div>
.loading {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    z-index: 999;
    height: 100%;
    background-color: #000000;
    opacity: 0.3;
    filter: alpha(opacity=30);
}

 上一篇
EasyUI 取消选中行高亮 EasyUI 取消选中行高亮
EasyUI 取消选中行高亮easyui 取消选中行高亮样式及点击某字段触发事件 onClickCell : function(index, field, value){ var me = this; if(field ==
2020-08-09
下一篇 
MySQL重置密码,环境变量 MySQL重置密码,环境变量
MySQL重置密码,环境变量重置密码Access denied for user 'root'@'localhost' (using password: YES) 1.停止mysql服务。service mysqld stop2. 运行下面
2020-08-09
  目录