开发者

using jQuery to reload entire page

开发者 https://www.devze.com 2022-12-21 15:13 出处:网络
Can I use jQuery.load() or and other jQuery function to load the entire page? Edit: I am looking for the abilit开发者_运维百科y to include data that the jQuery functions offer.You don\'t need jQuery

Can I use jQuery.load() or and other jQuery function to load the entire page?

Edit: I am looking for the abilit开发者_运维百科y to include data that the jQuery functions offer.


You don't need jQuery for that. Just do:

window.location.reload();


As you would like to have the information in a new page (the old being totaly replaced by new content IS a new page), ajax is not the answer, because it is used to place new content in an old page.

i would recommend injecting a form into the current page using javascript and submitting this form programmatically.

Quick'n'dirty (untested):

$("#formsPlaceholder").append('<form action="newpage" method="post" id="newForm"><input type="textfield" name="foo" value="bar"/></form>');
$("#newForm").submit();


No need for jQuery. location.reload(); will do it.


Do you want to refresh the page, or load the contents of a file into the page? To refresh the page you can call window.history.go(). To load another page into the body of this page, you can call $("body").load("path/to/other/page.html"). The other html page should not include the html, head or body tags, just the content of the body.


Putting the following at the required point should re: GET the page... unless i'm mistaken..

window.location = window.location;
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号