ajax局部刷新
1 <div id="ajaxflush"> 2 <ul> 3 <c:forEach items="${result.data}" var="img" varStatus="status"> 4 <li><a class="tp_1" href="javaScript:showinfo('${img.hdId}')"><img src="<%=request.getContextPath() %>/image.action?path=${img.savePath}&referType=SYS1006"> 5 <p><em>${img.enterpriseName}</em><br> 6 <em>${img.hdTypeName}</em><br> 7 <em>${img.hdDesc}</em> 8 </p> 9 <span> 10 ${img.createTime} 11 <strong id="${status.index}" onclick="locationStrong('${img.savePath}','${img.imageId}','${status.index}');">下载 ${img.downloadNum} 次</strong> 12 <input name="pagePath" type="hidden" value="${img.savePath}"> 13 <input name="imgId" type="hidden" value="${img.imageId}"> 14 </span> 15 </a> 16 </li> 17 </c:forEach> 18 </ul> 19 </div>
比如,我们需要对id为ajaxflush的div内部进行局部刷新
我们可以使用的jquery代码如下
1 $.ajax({ 2 type:"GET", 3 url:theurl, 4 success:function(data){ 5 var htmlDoc = $.parseHTML(data);//返回的data就是一个网页的DOM 6 $('#ajaxflush').html($(htmlDoc).find('#ajaxflush').html());//这里使用.find()方法就可以取到id为ajaxflush标签的DOM对象 8 } 9 })

浙公网安备 33010602011771号