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.
Method 1: Using the location. reload(): The location. reload() method reloads the current web page emulating the clicking of the refresh button on the browser.
The location. reload() method, will reload (or refresh) an entire web page after the Ajax has performed its operation, that is, extracted data from an xml file. Therefore, I have added location. reload() inside the success callback function.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With