Why is this form not submitted twice when hitting the button twice?

后端 未结 4 1903
予麋鹿
予麋鹿 2021-01-24 09:07

Edit 25.07.2018: As Pawnesh Kumar said in the answer, this seems to be a browser issue. If I hit the button multiple times in Firefox the below script will only

4条回答
  •  执笔经年
    2021-01-24 09:26

    Note: I'm no expert, so I might be wrong. This is just my opinion.

    To me, this seems like a browser quirk. It seems like Firefox intentionally ignores all the extra requests.

    Chrome

    In case of Chrome, if you click on the add button multiple times, multiple requests are sent to the server. Initially, all the extra requests are canceled (you can learn more about canceled here) since the server is not responding. However, once the server responds (i-e, once the sleep time is up), all the requests are processed immediately. I don't know why, but the server only sleeps for the first request. The rest of the requests are processed immediately.

    Edge

    Edge also sends multiple requests if you click the button multiple times.

    Firefox

    Firefox is a little weird. It just sends one request no matter how many times you click the button. All the extra requests are ignored.

提交回复
热议问题