Sumit
Sumit

Reputation: 609

Reloading the page with the post data

I have tried to find on the stackoverflow before asking but the answers, I have found, haven't resolved my problem.

The page I am working on sends the post request. On the click of the button, I have to reload the page with the same post request. Currently I am using

this.parent.location.reload();  

But it is sending a Get request. I have also tried

window.location.href = window.location.href;

But it is also not working.

Please suggest a way to reload the page with the same post request.

Upvotes: 2

Views: 413

Answers (1)

the6p4c
the6p4c

Reputation: 664

If you have server-side access, (which I assume you do), you could populate a hidden HTML form with the server side values, have the method of the form set to POST, and then send the form in JavaScript (with a submit() method). That will reload the page and maintain the POST values.

Upvotes: 2

Related Questions