How can I refresh a page with jQuery?

后端 未结 28 2439
刺人心
刺人心 2020-11-22 07:00

How can I refresh a page with jQuery?

28条回答
  •  隐瞒了意图╮
    2020-11-22 07:40

    You don't need anything from jQuery, to reload a page using pure JavaScript, just use reload function on location property like this:

    window.location.reload();
    

    By default, this will reload the page using the browser cache (if exists)...

    If you'd like to do force reload the page, just pass a true value to reload method like below...

    window.location.reload(true);
    

    Also if you are already in window scope, you can get rid of window and do:

    location.reload();
    

提交回复
热议问题