2017-01-11 14:27
浏览 59

Woocommerce aJax将优惠券代码应用于购物篮

I am attempting to apply a coupon code to the basket on a button press. I have the following code:-

coupon = jQuery(this).data('coupon');
data = {coupon_code : coupon};
jQuery.post( "?wc-ajax=apply-coupon", { coupon_code: coupon }).done(function( data ) {
    alert( "Data Loaded: " + data );

I can see the following data is being parsed to the server:-

coupon_code: 10percentdiscount

The 10percentdiscount exists.

The Server is not sending back a response once I have sent the request.

Am I correctly making this request or is there another way?

Thank you in advance.

图片转代码服务由CSDN问答提供 功能建议

我试图在按下按钮时将优惠券代码应用到购物篮。 我有以下代码: -

  coupon = jQuery(this).data('coupon'); 
data = {coupon_code:coupon}; 
jQuery.post(“?wc-ajax = apply- 优惠券“,{coupon_code:coupon})。done(function(data){
 alert(”Data Loaded:“+ data); 
 <  p>我可以看到以下数据被解析到服务器: -   

10percentdiscount 存在。


我是 正确提出这个请求还是有另一种方式?


  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

2条回答 默认 最新

相关推荐 更多相似问题