I have a piece of jquery that calls a method on the controller. This method updates items pertaining to what is on the screen.
In order to update the screen I therefore go:
location.reload(true);
The problem is this is bringing up the message:
“To display this page, Firefox must send information that will repeat any action (such as a search or order confirmation) that was performed earlier.”
Could someone please tell me how to prevent this message or an alternative to what I’m doing?
It’s happening because you have a form element with a POST action. Most modern browsers will not refresh the page when it was generated as a result of a POST request without asking first – because POST requests could be anything, like deleting a record, or submitting user information. When you access a page simply by going to the Url, that’s a GET request.
For this reason it’s recommended that you return “RedirectToAction” results from your actions, where state has been changed on a postback – this way, users can hit F5 on the destination page all they like without the error, at the small expense of an extra roundtrip to the server.