Using jQuery to reload the whole page

Can I use jQuery.load()another jQuery function to load the whole page?

Edit: I'm looking for an opportunity to include data that jQuery features offer.

+3
source share
5 answers

You do not need jQuery for this. Just do:

window.location.reload();
+14
source

How would you like to receive information on a new page (the old one, which is replaced by new content, this is a new page), ajax is not the answer, because it is used to place new content on the old page.

I would recommend injecting the form into the current page using javascript and submitting the 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();
+3

jQuery. location.reload(); .

+1

Do you want to refresh the page or upload the contents of the file to 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"). Another html page should not include html, head or body tags, as well as body content.

+1
source

Assuming the following at the desired point, you need to re: GET the page ... if I'm not mistaken ..

window.location = window.location;
+1
source

Source: https://habr.com/ru/post/1735172/


All Articles