Take the 2-minute tour ×

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.


share|improve this question
Are you posting the page normally, or through JavaScript/AJAX? –  Tieson T. Dec 21 '12 at 7:55

7 Answers 7

Try this:

window.location.href = window.location.href;
share|improve this answer

In your code add:

share|improve this answer

If you just want to clear the form, why not:

<input type="reset" value="Clear Fields">

You could also do it using:


Seems a waste to reload the page unless you need to do something else as well.

share|improve this answer
@Aristos - Thanks and good point, have updated my post. –  webnoob Dec 21 '12 at 8:22
location.href = location.href + '?' + Math.random();

This should work.

share|improve this answer
+1, but you also need to check if the '?' all ready exist on href. –  Aristos Dec 21 '12 at 8:04

Add the following:


share|improve this answer

The following will solve your problem:

share|improve this answer

use location.reload(true). This "hard" reloads the page ..

share|improve this answer

Your Answer


