朋友们
我有以下代码来刷新以下DIV id refreshDiv以每5秒自动刷新一次,但它不起作用
<div id ="refreshDiv" class="span2" style="text-align:left;">
<c:set var="map" value="${alertStatusForm.channelStateForRecipients[currentChannel]}"></c:set>
<div>
<label><img src="${channelIcon}">
${fn:length(map['DELIVERED'])}</label>
</div>
<div>
<label><img src="${channelIcon}">
${fn:length(map['FAILED'])}</label>
</div>
<div>
<label><img src="${channelIcon}">
${fn:length(map['IN_PROGRESS'])}</label>
</div>
</div>
function refreshDiv(){
$.ajax({
url: 'editReg.jsp'
}).done(function(result) {
$('#refreshDIV').text(result);
});
}
您不打来refreshDiv()
。您刚刚定义了它。加载dom时调用此函数,并每隔5秒钟使用继续调用一次setTimeout
。
$(function(){
function refreshDiv(){
$.ajax({
url: 'editReg.jsp'
}).done(function(result) {
$('#refreshDIV').text(result);
window.setTimeout(refreshDiv, 5000);
});
}
window.setTimeout(refreshDiv, 5000);
});
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句