JQuery Active Refresh Not Working After Server-Side Redirect

Posted by Ömer Faruk AK on Stack Overflow See other posts from Stack Overflow or by Ömer Faruk AK
Published on 2012-06-05T18:11:09Z Indexed on 2012/12/04 23:04 UTC
Read the original article Hit count: 180

Filed under:
|

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();
}

© Stack Overflow or respective owner

Related posts about jquery-ajax

Related posts about playframework