Prevent duplicate submissions in JavaScript

  There is such a situation:

  There is a button on the page, which will trigger an Ajax request after clicking, but after the user clicks, he does not know whether the click is successful, so he clicks again. If it is not processed, two Ajax requests will be made, and the requested data will be It is the same, it will have a certain impact on the back-end program.

  Solution: After the user clicks the button, before receiving the result returned by the backend program, set the button to grayscale, that is, set it to unclickable and disabled.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324842846&siteId=291194637