防止重复提交 [英] Prevent double submits

查看:61
本文介绍了防止重复提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将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屋!

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