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>
Tim S. Van Haren
  • 8,861
  • 2
  • 30
  • 34
Fred Junior
  • 31
  • 1
  • 2

1 Answers1

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.

Community
  • 1
  • 1
Zar
  • 6,786
  • 8
  • 54
  • 76
  • also `window.location.href = window.location.href`, see http://stackoverflow.com/questions/2405117/difference-between-window-location-href-window-location-href-and-window-location – house9 Jan 26 '13 at 22:38
  • @house9 no need for `.href` You can just use `window.location` – ModernDesigner Jan 26 '13 at 22:39