I am trying to reload the page using java script the page reloads but the post data in the page is not loading the post data are deleted while the page reloads can any one help me with it
function currencychange(xxx) {
setTimeout('delay()', 2000);
}
function delay(){
location.reload();
}
this is the javascript code which I am using to reload the page onchange
window.location.reload()
issues a GET
, so yes, the POST
data will be lost.
The only ways you can issue a post are either:
Use AJAX to post the data back, get the new page, and replace your body element with it, or
Create a form element on the page with the action being the current window.location.href
, and place the data you want to post back inside it as hidden inputs. Then, on currency change call form.submit()
I think you need to re-POST not re-load, as in HTTP POST rather than HTTP GET.
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