我有一个页面每 5 秒主动刷新一次。但是,当我从页面中单击一个按钮时,该按钮在服务器端重定向到自身,然后它不会刷新。我能做些什么?
jQuery代码;
<script type="text/javascript" charset="${_response_encoding}">
// Reload the whole messages panel
var refresh = function() {
$('#thread').load('@{room()} #thread', function() {
$('#thread').trigger('create');
});
}
var create = function(){
$('#thread').trigger('create');
}
// Call refresh every 5 seconds
$(document).ready(setInterval(refresh, 5000));
</script>
服务器端代码;
public static void served(Long servingID) {
Serving serv = Serving.findById(servingID);
serv.isServed = true;
serv.save();
index();
}