It seems like you're having trouble with the appendTo function not working after the AJAX request is complete.

One possible solution is to use event delegation to ensure that the appendTo function works on dynamically added elements. You can modify your code as follows:

$(document).on('complete', function() {
  $(".nav-links").appendTo(".qq_loop_products_pagination");
  $(".paging-content .nav-links ").remove();

  if (typeof LocomotiveScroll !== 'undefined') {
    // Locomotive Scroll exists, do something here
    scrollQ.update();
  }
});

By using $(document).on('complete', function() { ... }), you are binding the complete event to the document and ensuring that it will work on dynamically added elements as well.

Make sure to trigger the complete event at the end of your AJAX success and error functions:

success: function(d_page) {
  $('.loadingis').remove();
  $('.paging-content').html(d_page);
  $('.qloop_content_fake').hide();
  $('.qloop_content').show();
  $('.paging-content').removeClass('qqshimmer');
  
  $(document).trigger('complete');
},
error: function(d_page){
  $('.loadingis').remove();
  $('.paging-content').removeClass('qqshimmer');

  console.log(d_page);
  $(document).trigger('complete');
  return false;
},

This should ensure that the appendTo function works correctly after the AJAX request is complete

$ajax type POST url qqajaxurl data action qq_posts_loadXurldata getdata dataType html	 beforeSend function 	var htmlCode = div class=qq33w qqflr qqinrow qq_product_in_list qq_

原文地址: https://www.cveoy.top/t/topic/isXg 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录