< button type =" submit">与onclick提交两次? [英] <button type="submit"> with onclick submitting twice?

查看:129
本文介绍了< button type =" submit">与onclick提交两次?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正面临一些重复订单问题。没有详细说明,我对以下内容有疑问。是否有可能触发提交两次?

< button type =submitonclick =review.save() >< / button>



review.save()提交表单 - 所以实际上这里不需要type = submit。但是我想确定这个CAN是否会导致浏览器提交两次。在服务器日志中,2次提交相距约10秒。

解决方案

您需要防止默认浏览器行为,例如:

 < button type =submitonclick =review.save(); return false;>< / button> ; 


I am currently facing some order duplication issues. Without going into too much detail, I had a question about the following. Is there any possibility that this can trigger a submit twice?

<button type="submit" onclick="review.save()"></button>

review.save() will handle the submission of the form - so in fact the type=submit isn't needed here. But I want to establish whether this CAN cause the browser to submit twice. On the server logs the 2 submits were about 10 seconds apart.

解决方案

You need to prevent default browser behaviour, for example:

<button type="submit" onclick="review.save(); return false;"></button>

这篇关于&lt; button type =&quot; submit&quot;&gt;与onclick提交两次?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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