Chrome触发“立即购买"按钮上的双重操作 [英] Chrome triggering double action on Buy Now Button

查看:92
本文介绍了Chrome触发“立即购买"按钮上的双重操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果客户单击我们的任何产品上的立即购买"(例如

On our website if a customer clicks on Buy Now on any of our products (example https://www.nutricentre.com/p-53682-advanced-brain-nutrients.aspx) it adds a quantity of 1 in Firefox but 2 in Chrome. I've looked through the code and cannot see any reason why it would do this.

代码相当简单

<a class="blue_btn" >
    <xsl:attribute name="href">#</xsl:attribute><xsl:attribute name="id">Buy_<xsl:value-of    select="VariantID"/></xsl:attribute><span>Buy Now</span></a>

有人发现原因可能是什么?我已经尝试过开发工具并添加了一个断点,但是看不到为什么它会触发两个

Anybody shed a light on to what the cause maybe? I've tried dev tools and adding a breakpoint but cannot see why its triggering two

推荐答案

我可能缺少明显的东西,但是我想知道问题是在后端而不是前端吗?沿着您的函数路径放入一些console.log(),看看正在发送到后端的内容.是2(尽管在框中是"1"),还是您的服务器从客户端收到了"1",但是在购物车装载时它变成了2?

I might be missing something glaringly obvious, but I'm wondering if the issue is on the backend rather than the front end? Throw in some console.log()'s along your function path and see what is being sent to the backend. Is it a 2 (despite '1' in the box), or does your server receive a '1' from the client and yet it's turned into a 2 by the time the cart loads?

您的'== 0'代码工作正常,因此正在读取.val().

Your '== 0' code works fine, so your .val() is being read.

这篇关于Chrome触发“立即购买"按钮上的双重操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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