使用JQuery自动刷新DIV

ron*_*nan 1 javascript ajax jquery

我的要求是每5秒自动刷新一次DIV

我要刷新的DIV内容是

<div class="row-fluid">
    <div class ="span2">
        <label><spring:message code='total.registration' />:</label>
    </div>
    <div class = "span3">
        ${registrationStatusForm.totalRegis}
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

我还检查了一些关于stackoverflow的问题但是不明白.请注意我正在使用Spring Web MVC.请建议.

Bra*_*rad 5

这是一个jquery问题而不是春天问题,因为刷新将在客户端上进行管理.

在jquery中,这样的东西是合适的:

$(document).ready(function(){
    setInterval(refreshDiv, 5000); 
}); 

function refreshDiv(){
    $.ajax({
        url: "http://path.to.your/webservice",
        //other stuff you need to build your ajax request
    }).done(function() {
        //update your div
    });
}
Run Code Online (Sandbox Code Playgroud)