Coder Perfect

How can I refresh a page with jQuery?

Problem

How do I use jQuery to refresh a page?

Asked by luca

Solution #1

Use location.reload():

$('#something').click(function() {
    location.reload();
});

The extra parameter true can be used to the reload() function to force a reload from the server rather than the cache. Because the setting defaults to false, the page may reload from the browser’s cache by default.

Answered by Roy

Solution #2

With JavaScript, you may refresh a page in an infinite number of ways:

You can keep going with the list by being inventive:

Answered by Ionică Bizău

Solution #3

Even without jQuery, this should work in all browsers:

location.reload();

Answered by Thorben

Solution #4

I’m sure a variety of approaches will work:

Answered by David

Solution #5

To use jQuery to reload a page, follow these steps:

$.ajax({
    url: "",
    context: document.body,
    success: function(s,x){
        $(this).html(s);
    }
});

Ajax jQuery was the method I utilized in this case. Chrome 13 was used to test it. Then I placed the code that will cause the reload in the handler. “” is the URL, which implies “this page.”

Answered by Peter

Post is based on https://stackoverflow.com/questions/5404839/how-can-i-refresh-a-page-with-jquery