Organizational Research By

Surprising Reserch Topic

How can I refresh a page with jQuery?



asked May 20, 2015 in JAVASCRIPT by rajesh
0 votes
30 views



Related Hot Questions

4 Answers

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

Like mplungjan explained in the comment below, the reload() function takes an optional parameter that can be set to true to reload from the server rather than the cache. The parameter defaults to false, so by default the page reloads from the browser's cache.

answered May 20, 2015 by rajesh
0 votes
location.reload();

Should work on all browsers even without jQuery

answered May 20, 2015 by rajesh
0 votes

Lots of ways will work, I suppose:

  • window.location.reload();
  • history.go(0);
  • window.location.href=window.location.href;
answered May 20, 2015 by rajesh
0 votes

To reload a page with jQuery, do:

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

The approach here that I used was Ajax jQuery. I tested it that worked on Chrome 13. Then I put the code in the handler that will trigger the reload. The URL is "", which means this page.

answered May 20, 2015 by rajesh

...