单击时禁止复选框更改 [英] Inhibit a checkbox from changing when clicking it
问题描述
我想要网页上的复选框。当我单击它时,它会将ajax请求发送到服务器。服务器答复时,我希望复选框更改。我可以修复所有问题,但单击该复选框会立即更改状态。
确定要这样做吗? Ajax-Request可能会花费一些时间。当用户没有反馈时,他们可能倾向于一次又一次地单击,直到发生某些事情为止。当取消激活按钮后(再次过一段时间),用户会更加困惑。它表示与服务器(例如,著名的纺车)之间的通信。结果返回时,隐藏指示器并根据需要取消激活该复选框。您可能还想禁止在ajax请求期间发布表单。
I want a checkbox on a web page. When I click it, it sends an ajax request to the server. When the server replies, I want the checkbox to change. I can fix everything except the fact that the checkbox immediately changes state when clicked.
Are you sure you really want this? An Ajax-Request can take its time. When the user gets no feedback, they may be inclined to click again and again, until something happens. When this deactivates the button (again after some time) the user gets even more puzzled.
Rather think about providing immediate feedback (e.g. check the box) and display an indicator next to it, that signals communication with the server (e.g. the famous spinning wheel). When the result is back, hide the indicator and deactivate the checkbox if needed. You may also want to inhibit posting the form during the ajax request.
这篇关于单击时禁止复选框更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!