How to refresh and reload the page without resending the POST data?
I have tried location.reload()
which works absolutely fine on Chrome(which was the testing environment while development). But IE and Firefox went into an Infinite Loop in JS - reposting a lot of junk/duplicate data.
Note: However, I just want to refresh the page to clear all the form contents. I am also registering a start up script after Submit, that will show the alert message that data was added successfully.
HELP!
Try this:
window.location.href = window.location.href;
location.href = location.href + '?' + Math.random();
This should work.
In your code add:
Response.Redirect(Request.RawUrl)
If you just want to clear the form, why not:
<input type="reset" value="Clear Fields">
You could also do it using:
document.getElementById('<%=form1.ClientID%>').reset();
Seems a waste to reload the page unless you need to do something else as well.
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