javascript - jquery refresh element - How can I refresh a page with jQuery?

jquery refresh page without reload / javascript / jquery / refresh / reload

How can I refresh a page with jQuery?

Elijah Manor



Answer #1

The easiest way is a one line solution placed in an appropriate way:

location.reload();

Solution1: Force reloading the current page from the server

location.reload(true);

Solution2: Reloading from cache or server (based on browser and your config)

location.reload(false);
location.reload();

And if you want to combine it with jQuery an listening to an event, I would recommend using the ".on()" method instead of ".click" or other event wrappers, e.g. a more proper solution would be:

$('#reloadIt').on('eventXyZ', function() {
    location.reload(true);
});