Reputation: 423
I am reloading/refreshing a page using javascript
method document.location.reload()
.
I am getting the alert message :
The browser needs to resend the information
How can I avoid this alert message and reload my page ?
Upvotes: 0
Views: 1150
Reputation: 1221
Do you need to do a complete reload, including sending the previously POSTed data to the server? If you need to 'reload' the result of a POST then you can't do it without the warning message, however if you just want to GET the same page again you can use window.location = window.location;
Upvotes: 2
Reputation: 36784
You can't. Almost all browsers have an alert like that upon reload because of forms posts.
If a purchase was made online, more likely than not it would use a form. If that form got resubmitted it could cause the payment to occur again. This is why we get warnings from out browsers, to stop us accidentally resubmitting forms.
I would recommend that, after you have submitted your form successfully, redirect your page to itself without resubmitting the form. Then you can reload to your hearts content.
Upvotes: 1