0

我的 Java EE 应用程序(JSP 文件,从 Servlet.java 调用)中有以下代码:

    <div class="drop">               
           <c:forEach var="widget" items="${widgets}">
              <div class="drag">
                 <p><h2>Widget</h2></p>
                 // WIDGET GRAPHIC REPRESENTATION
              </div>
           </c:forEach>
     </div>
     <input class="add" type="image" src="image.jpg">

我想要的是在浏览器中加载和显示 JSP 文件,然后加载小部件。只要未加载小部件,理想情况就会显示加载图标。如何实现这样的异步解决方案?有人可以解释和/或做一个小演示吗?

4

1 回答 1

1

我认为这应该对您有所帮助,我不确定

//use id of div(that contains the widgets) that 
//you want to hide before all widget are shown
$('#my_div_id')
    .hide()  // hide it initially and then use load event handler
    .load(function() {
        $(this).show();//display/show the div when load completes
    })
;
于 2012-11-19T13:41:18.320 回答