< button type =" submit">与onclick提交两次? [英] <button type="submit"> with onclick submitting twice?
问题描述
我目前正面临一些重复订单问题。没有详细说明,我对以下内容有疑问。是否有可能触发提交两次?
< 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>
这篇关于< button type =" submit">与onclick提交两次?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!