Fred Junior
Fred Junior

Reputation: 31

refresh page after jquery/javascript event?

Can someone please show me how i can add an automatic page refresh after the following jquery event has taken place?

Thanks.

<script>
    $(document).ready(function() {
        setTimeout(function() {
            $(".infobox-forum").fadeOut("slow", function () {
                $("infobox-forum").remove();
            });         
        }, 2000);
     });         
 </script>

Upvotes: 2

Views: 2892

Answers (1)

Zar
Zar

Reputation: 6882

Yes, you can use location.reload() to do this:

$(document).ready(function(){
    setTimeout(function(){
        $(".infobox-forum").fadeOut("slow", function () {
            $("infobox-forum").remove();
            location.reload(); // <---
        });
    }, 2000);
});

Another posibility is to use window.location.href = window.location.href instead. To decide which one to choose, see this question.

Upvotes: 3

Related Questions