Advertisement
Guest User

Untitled

a guest
Dec 7th, 2016
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. (function ($) {
  2. Drupal.behaviors.custom_module = {
  3. attach: function (context, settings)
  4. {
  5. console.log("step 1");
  6. $('.view').ajaxComplete(function (event, XMLHttpRequest, ajaxOptions) {
  7. response = XMLHttpRequest.responseText;
  8. result = response.search(/"status": false/i);
  9. console.log("step 2");
  10. if (result == -1) {
  11. console.log("step 3");
  12. $("form.commerce-add-to-cart").each(function () {
  13. $(this).attr("action", window.location.pathname);
  14. });
  15. }
  16. else {
  17. console.log("failure binding on ajax complete");
  18. }
  19. });
  20.  
  21. }
  22. };
  23. })(jQuery);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement