Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function ($) {
- Drupal.behaviors.custom_module = {
- attach: function (context, settings)
- {
- console.log("step 1");
- $('.view').ajaxComplete(function (event, XMLHttpRequest, ajaxOptions) {
- response = XMLHttpRequest.responseText;
- result = response.search(/"status": false/i);
- console.log("step 2");
- if (result == -1) {
- console.log("step 3");
- $("form.commerce-add-to-cart").each(function () {
- $(this).attr("action", window.location.pathname);
- });
- }
- else {
- console.log("failure binding on ajax complete");
- }
- });
- }
- };
- })(jQuery);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement