过滤新内容仅显示特定的div

要在我的页面中加载更多内容,我正在使用jQuery.get()函数检索外部页面链接。

我可以检索所有页面,但是,当我试图过滤结果只获得“.container_journal_post”div时,我无法使其工作。 欢迎您的帮助。

这是我目前的HTML代码:

 

这是我的外部页面HTML代码:

  

这是我的javascript函数:

 jQuery(document).ready(function($) { var pageNum = parseInt($("#current_page")[0]["innerHTML"]); // Get the page number var max = parseInt($("#max_num_pages")[0]["innerHTML"]); // Get the maximum number of the blog section. var nextLink = $("#pagination .next")[0]["href"]; // Get The link of the next page of posts. // A button where the user is cliking to load more posts $('#append').click(function(){ makeboxes(); }); makeboxes = function() { var boxes = new Array; $.get(nextLink, function(data) { // console.log(data); // Return the "nextLink" HTML DOM // Can't cut it correctly // console.log($(data)); // Return 100 items // I would like to get something like this: $(data).filter( 'article' ).each( function( key, value ) { // value has to be equal at // 
post 34
boxes.push(value); } ); // load at the end of the div the new boxes jQuery( "#related_projects" ).gridalicious( 'append', boxes ); }); } });

调用“makebox”函数后需要的结果:

  

你可以使用jquery的load函数:

$('#result').load('ajax/test.html #container');#container是被提取内容的选择器

(参见jquery加载文档 )