tags:

views:

117

answers:

5

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

Edit: I am looking for the ability to include data that the jQuery functions offer.

+9  A: 

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

window.location.reload();
beamrider9
+1  A: 

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

Amber
+1  A: 

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.

Marius
I also have a lot of stuff in the head, is it possible to just do the entire page?
Brian
+1  A: 

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

window.location = window.location;
jwwishart
location.reload() as per the others. don't use this :)
jwwishart
+3  A: 

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();
henchman
+1 for actually POSTing data- I was just about to answer similar to this...
Matt Luongo