Such a problem. On the site, the code intercepts the link following the link and it does not occur, but the function works. However, after deleting (that is, triggering a function), the other is deleted with a redirect. How to avoid this, please help, the project is on. Drupal engine 8.6.4. JS code:

!(function ($) { $(document).ajaxComplete(function(event, xhr, settings) { alert("second"); console.log('Edit post!!'); console.log('Event'); console.log(event); console.log('Index!!!'); console.log(settings.url.indexOf('add_to_inquiry_list')); console.log('Settings'); console.log(settings); if (settings.url.indexOf('add_to_inquiry_list') != -1) { var trigger_menu = $('.rmm-toggled'); if(!trigger_menu.hasClass('rmm-closed')) { trigger_menu.next('.nano').removeClass('.has-scrollbar').hide(); trigger_menu.addClass('rmm-closed') } var search_block = $('#block-customautosearch-2'); search_block.hide(); $('a.header_search').removeClass('search-is-visible'); if(!$('#b-pop-up-header').is(":visible")) { $('#b-pop-up-header').slideDown(); } updateInquiryBlock(); } }); function updateInquiryBlock() { alert('first'); $.ajax({ url: '/get_count_cart', type: "GET", dataType : "html", cache: false, success: function(data){ $('.header_cart .counter').html(data); } }); $.ajax({ url: '/inquiry_block', type: "GET", dataType : "html", cache: false, success: function(data){ if(data != ""){ $('.view-id-inquiry_list.view-display-id-block_1').html(data); $('.block-views-blockinquiry-list-block-1').addClass('fixed'); $('.block-views-blockinquiry-list-block-1 .view-inquiry-list').hide(); $('.block-views-blockinquiry-list-block-1 .view-inquiry-list').slideToggle("slow"); } } }); } })(jQuery); 

    1 answer 1

    What is the transition? Which link? The project will burn (.

    Answer:

    Use event handling delegation.

    • That is, there are blocks with delete buttons, the rest are not caught once - Edward Kapuchinsky
    • @EduardKapuchinsky Do you think everything became clear to me? No, it did not. However, I already wrote you what to do. - Igor