JQuery Active Refresh Not Working After Server-Side Redirect
- by Ömer Faruk AK
I have a page which is refreshing actively every 5 second. But when i click a button from the page which is redirect to itself at server-side and then it's not refreshing. What can i do?
JQuery Code;
<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>
Server-Side Code;
public static void served(Long servingID) {
Serving serv = Serving.findById(servingID);
serv.isServed = true;
serv.save();
index();
}