通过ajax调用防止双击按钮 [英] preventing double clicks on button with ajax call

查看:174
本文介绍了通过ajax调用防止双击按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到我的用户有时会点击两次按钮,也许没人告诉他们一次点击就足够了。



防止双击的最佳方法是什么?
我基本上隐藏了按钮并显示了一个加载gif,但这显然是不够的... ...

解决方案

如果他们点击的速度足以触发双击事件,则返回false。

  ondblclick =返回false

编辑:这不会取消单击事件,因此问题仍然存在。

I noticed my users sometimes click the buttons twice, maybe no one told them one click is enough.

What's the best way to prevent the double-click? I basically hide the button and show a "loading" gif, but that apparently is not enough...

解决方案

If they are clicking fast enough to fire the double click event, return false.

ondblclick="return false"

EDIT: This will not cancel the single click event so problem would still exist.

这篇关于通过ajax调用防止双击按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆