在AJAX完成后调用window.load函数

我正在使用一个wordpress主题,它有很多样式选项等,由header.php文件读取,并根据它做样式和一些js的东西。 例如,以下是它的外观片段:

jQuery(window).load(function($) {  jQuery('#posts-container').infinitescroll({ navSelector : "div.pagination", // selector for the paged navigation (it will be hidden) nextSelector : "a.pagination-next", // selector for the NEXT link (to page 2) itemSelector : "div.post", // selector for all items you'll retrieve errorCallback: function() { jQuery('#posts-container').isotope('reLayout'); } } }); }); 

这是一个片段,但还有很多。 这是在我的header.php文件中。 然后我在custom.js文件中执行一些AJAX调用。 它看起来像这样:

 var term_id = $(this).attr('id'); $.ajax({ url: ajaxurl, type: "POST", async: true, cache: true, data: { action: 'show_blog', term_id: term_id }, success: function(data) { jQuery(window).load(); $('.blog-wrapper').fadeOut(1000, function() { $('.blog-wrapper').html(data); $(".blog-wrapper").fadeIn(1000); }); } }); 

我试图使用jQuery(window).load(); 但是我的header.php文件中的JS没有被触发。 在AJAX调用之后,如何在header.php文件中重新触发window.load代码? 我是否需要将其置于不同的function中,然后执行以下操作:

 jQuery(window).load(function($) { do_styling_function(); }); 

然后在我的AJAX调用中我也可以调用do_styling_function();

只需以通常的方式触发onload事件:

 jQuery(window).trigger('load');