问题描述:
后台用的struts2,
页面:
function selectyy(aa,bb) { $.ajax({ type: "POST", url: "getSfxyyzsbyy.html?Datetime=" + GetCurrentTime(), data:{"aa":aa,"bb":bb}, dataType: 'html', success:function(responseText){ alert(responseText); $('#yy).replaceWith(responseText); } }); } function GetCurrentTime() { var theDate = new Date(); var str = theDate.getFullYear() + "-" + (theDate.getMonth() + 1) + "-" + theDate.getDate() + "-" + theDate.getHours() + "-" + theDate.getMinutes() + "-" + theDate.getSeconds(); return str; }
其中ff.jsp页面包含了一个div
','0')">
/c:forEach
每单击一下连接执行一次异步,让返回的jsp内容替换掉原来的div id为yy的内容。。。但是现在的问题是:
只有第一次异步执行后id为yy的div内容会被替换掉。。。但是每次alert(responseText)时内容却是不同的。。
有点不懂了。。为了没有缓存还让url带了个唯一参数。。但是问题还是只有第一次执行后yy会被替换掉。
请je的朋友解答下。
注:
jquery版本:1.4.2
struts2:2.18
spring3.0.2
ibatis-sqlmap-2.3.4.726
你返回的内容里面还有id为yy 的div么
你把它给替换掉了,如果内容里没有id为yy的div,下一次自然就不执行了
参考[url]http://www.yinse5.com/user.aspx?userName=panyi5202[/url]
二楼的参考价值太高了 :arrow: