[英]Asynchronous div
I have the following code in my Java EE application (JSP file, called from Servlet.java): 我的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">
What I want is loading and displaying the JSP file in the browser, and AFTER that, loading the widgets. 我想要的是在浏览器中加载并显示JSP文件,然后再加载小部件。 The ideal situation would show a loading icon as long as a widget isn't loaded.
只要未加载小部件,理想情况下将显示一个加载图标。 How can I implement such an asynchronous solution?
如何实现这样的异步解决方案? Could someone explain and/or give a small demo?
有人可以解释和/或做一个小演示吗?
I think this should help you, I am not sure 我认为这应该对您有帮助,我不确定
//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
})
;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.