diff --git a/core/app/assets/javascripts/spree.js.erb b/core/app/assets/javascripts/spree.js.erb index 6351918c769..1d0d036d958 100644 --- a/core/app/assets/javascripts/spree.js.erb +++ b/core/app/assets/javascripts/spree.js.erb @@ -23,8 +23,8 @@ Spree.pathFor = function(path) { }; Spree.url = function(uri, query) { - if (Spree.env === 'development' || Spree.env === 'test') { - console.warn('Spree.url is deprecated, please use Spree.ajax for your request instead.'); + if (console && console.warn) { + console.warn('Spree.url is deprecated, and will be removed from a future Solidus version.'); } if (uri.path === undefined) { uri = new Uri(uri); diff --git a/frontend/app/assets/javascripts/spree/frontend/checkout/coupon-code.js.coffee b/frontend/app/assets/javascripts/spree/frontend/checkout/coupon-code.js.coffee index 41725250bfb..633ed3207e9 100644 --- a/frontend/app/assets/javascripts/spree/frontend/checkout/coupon-code.js.coffee +++ b/frontend/app/assets/javascripts/spree/frontend/checkout/coupon-code.js.coffee @@ -6,18 +6,18 @@ Spree.onCouponCodeApply = (e) -> couponStatus = $("#coupon_status") successClass = 'success' errorClass = 'alert' - url = Spree.url(Spree.routes.apply_coupon_code(Spree.current_order_id), - { - order_token: Spree.current_order_token, - coupon_code: couponCode - } - ) couponStatus.removeClass([successClass,errorClass].join(" ")) + data = + order_token: Spree.current_order_token, + coupon_code: couponCode + req = Spree.ajax - method: "PUT", - url: url + method: "PUT" + url: Spree.routes.apply_coupon_code(Spree.current_order_id) + data: JSON.stringify(data) + contentType: "application/json" req.done (data) -> window.location.reload()