防止重复提交 [英] Prevent double submits
问题描述
我正在将GAE用于具有各种Submit href按钮的应用程序,并使用javascript进行提交.
I am using GAE for an app that has various submit href buttons, and use javascript to submit.
我很难确定如何防止多次提交或双击.我尝试了各种方法来禁用或删除带有JavaScript的href.
I am having a real tough time trying to figure out how to prevent multiple submits or doubl-clicking. I have tried various methods to disable or remove the href with javascript.
但是我在考虑后端是否可能有防止这种情况的方法.
But I am thinking if there is maybe a method to prevent this in the backend.
您会建议我使用哪些方法?
What methods would you recommend I use?
推荐答案
在服务器端进行预防并非易事-再次调用可能会遇到其他实例.因此,您需要处理会话.代码将很快变得复杂.
Preventing it on the server side is not trivial - a second call may hit a different instance. So you need to deal with sessions. The code will get complex quickly.
我建议在通话前禁用该按钮,并在响应时重新启用它.
I would recommend disabling the button before a call and reenabling it upon a response.
这篇关于防止重复提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!