weixin_33720186 2014-11-17 12:31 采纳率: 0%
浏览 5

无法隐藏加载图片

In my jsp page.. I am displaying table dynamically using jquery. Everything is fine but now the image/text used to show until page ready is not getting hidden even after I displayed table. What's the problem?/

Here is my code:

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
    <%@ page import="java.sql.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>DbRefresh Sample</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script>
var url="/DbRefresh/FetchRecords";
$(document).ready(function(){
    $('#loading').hide();
    //$.ajaxSetup({cache:false});
    setInterval(callUrl,15000);
    function callUrl()
    {
        //alert("Called");
        $.ajax({
            url:'/DbRefresh/FetchRecords',  
            type:'post',  
            dataType: 'json',
            cache: false,
            contentType: 'application/json',
            success: function(data) {
                $("tr td").remove();
                $.each(data.obj,function(index,obj)
                        {
                $("#table").append('<tr><td>'+obj.name+'</td><td>'+obj.age+'</td></tr>');
                    })
                   //$("tr td").replacewith(tabdata);
                } 
            });
        }
});

</script>
<style type="text/css">
#loading {
  width: 100%;
  height: 100%;
  top: 0px;
  left: 0px;
  position: fixed;
  display: block;
  opacity: 0.7;
  background-color: #fff;
  z-index: 99;
  text-align: center;
}

#loading-image {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 100;
 }
</style>
</head>
<body>
<div id="table">
<table border='4' cellpadding='6' cellspacing='3' width='300px'>
<thead><tr bgcolor='66FF00'><th>Name</th><th>Age</th></tr></thead>
</table>
</div>
<img id="loading-image" src="images/ajax-loader.gif" alt="Loading..." />
</body>
</html>

</div>
  • 写回答

3条回答 默认 最新

  • DragonWar% 2014-11-17 12:33
    关注

    there is no tag with "loading" id

    so make it like

    $('#loading-image').hide();
    
    评论

报告相同问题?

悬赏问题

  • ¥20 基于MSP430f5529的MPU6050驱动,求出欧拉角
  • ¥20 Java-Oj-桌布的计算
  • ¥15 powerbuilder中的datawindow数据整合到新的DataWindow
  • ¥20 有人知道这种图怎么画吗?
  • ¥15 pyqt6如何引用qrc文件加载里面的的资源
  • ¥15 安卓JNI项目使用lua上的问题
  • ¥20 RL+GNN解决人员排班问题时梯度消失
  • ¥60 要数控稳压电源测试数据
  • ¥15 能帮我写下这个编程吗
  • ¥15 ikuai客户端l2tp协议链接报终止15信号和无法将p.p.p6转换为我的l2tp线路