0

How can I force refresh a page using javascript? But without resubmitting the form or prevent the confirmation message that says resending the information I previously submitted.

refresh

I need to accomplish this to prevent double entry of records. Thanks in advance.

I'm using window.location.reload()

2
  • You should post your full submit code. What language are you submitting to? How are you processing the post data? Commented Oct 31, 2012 at 1:00
  • I'm using ASP. There is an alert message before form submission, that's why I cannot use ASP to reload the page or else the alert message does not show. Commented Oct 31, 2012 at 1:06

2 Answers 2

3

You can force change method to get by using window.location.reload(true) or window.location.href = window.location.href.

Sign up to request clarification or add additional context in comments.

1 Comment

window.location.href = window.location.href did work. Thank you so much
1

Your previous page was the result of a POST action.

The best practice is to do an HTTP 302 redirect after the post to a "clean" URL (eg a GET).

This ensures that the post action isn't performed twice accidentally and the warning goes away.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.