如何在单击按钮时拒绝多个请求



我有一个按钮,如果我多次按下它,它就会发送请求。如何在1个初始请求成功后阻止所有请求?

您可以使用按钮的disabled属性在请求开始发送后禁用,然后如果需要,您可以在收到数据后启用它。

类似:

function sendRequest() {
// disable the button on start of this function
// request code operations
// enable the button here
}

相关内容

最新更新