6

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
  • Any more specifics? Are you trying to reload on click? At an interval? Commented Mar 3, 2010 at 4:30
  • What "data that the jQuery functions offer" do you mean? The ability to pass parameters? Commented Mar 3, 2010 at 4:30
  • include data how? A usage example could help clarify Commented Mar 3, 2010 at 4:30
  • 1
    I have an array that I would like to pass to the new page as post data. It is not coming from a form. Commented Mar 3, 2010 at 4:37
  • @Pointy henchman's answer seems to offer a bit of value to this question- using JQuery to boot. Not that I disagree with you about OP's misunderstanding. Commented Mar 3, 2010 at 4:58

5 Answers 5

15

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

window.location.reload();
Sign up to request clarification or add additional context in comments.

1 Comment

For those who can't get this to work - it may be that your page is cached, which you can solve by adding this neat trick: stackoverflow.com/questions/6338800/…
3

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();

Comments

1

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

Comments

1

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.

1 Comment

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

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

window.location = window.location;

1 Comment

location.reload() as per the others. don't use this :)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.