javascript - When clicking a button to add content, if the network is stuck, clicking multiple times will add multiple content.
为情所困2017-05-19 10:10:22
0
2
532
When clicking the button to add content, if the network is stuck, clicking the button multiple times will send multiple requests and add multiple content. How should the front end handle it.
Set the button to disabled when clicking send
Send a request
After requesting the callback (regardless of success or failure), set the button to be available
Disable the button after clicking it, wait for the network to respond, and then undisable it