Why does F5 refresh cause repeated form submission?

Source: Internet
Author: User

First, the page is loaded for the first time. If no operation is performed and the form has not been submitted, click F5 to refresh. There is no problem.

F5 refresh causes repeated form submission

Prerequisites:

The user has passed

(1) submit button

(2) form submitted by form. Submit () in Js.

(3) I don't know about other methods. I hope you can tell me what you want.

A form is submitted.

Based on the form submission method, you can view two situations after the form is submitted,

Get: in the address bar, you can see the page address bar changes:

? The following parameters are passed when the form is submitted. There is no doubt that these parameters will be resubmitted during F5 refresh.

Post: Open the developer tool in chrome to view the data submitted by the form.

It can be seen that when F5 is refreshed, data will be re-submitted.

 

As for the post submission method, the browser will prompt

Because the "Standard Convention" post will change the server data, but the get method will not. In fact, whether it is get or post, how the server operates the data on the server after receiving parameters is a problem on the server and is irrelevant to the client.

 

Why does F5 refresh cause repeated form submission?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.