2

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>

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

2 Comments

also window.location.href = window.location.href, see stackoverflow.com/questions/2405117/…
@house9 no need for .href You can just use window.location

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.