$.ajax({
method:"get",
url:"/wall",
data:"ajax=1",
beforeSend:function(){},
success:function(html){
$("#grid_mason").append(html); //Add the next boxes to the Grid.
$(this).masonry({ appendedContent: $( html ), animate:false, resizeable:false });
});
}
});
http://desandro.com/demo/masonry/docs/appending.html
我正在使用该Masonry插件,并且有关附加的讨论。
最佳答案
如果您将砌体应用于#grid_mason
,请尝试从以下位置更改代码
$("#grid_mason").append(html);
$(thiz).masonry({ appendedContent: $( html ), animate:false, resizeable:false });
对此
$("#grid_mason").append(html)
.masonry({ appendedContent: $( html ), animate:false, resizeable:false });
不知道我是否可以在不看更多代码的情况下提出其他建议。
关于javascript - 如何在JQuery中做到这一点? (获取从AJAX-GET返回的HTML,并将其转换为对象),我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/4407509/