NikolayBezay

3d Innovation submit coupon JS(for all pages!)

Mar 30th, 2021
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.52 KB | None | 0 0
  1. <script>
  2. (function() {
  3.     var COUPON_TEXT = 'FB25';
  4.     var URL = window.location.origin + '/checkout/cart/couponPost/?remove=0&coupon_code=' + COUPON_TEXT;
  5.     var data = null;
  6.     var xhr = new XMLHttpRequest();
  7.     xhr.withCredentials = true;
  8.     xhr.addEventListener('readystatechange', function () {
  9.         if (this.readyState === 4) {
  10.             window.location.reload(true);
  11.         }
  12.     });
  13.     xhr.open('POST', URL);
  14.     xhr.setRequestHeader('cache-control', 'no-cache');
  15.     xhr.send(data);
  16. })();
  17. </script>
Advertisement
Add Comment
Please, Sign In to add comment