[英]How do I do this in JQuery? (get the HTML returned from AJAX-GET and turn it into an object)
$.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 http://desandro.com/demo/masonry/docs/appending.html
I'm using that Masonry plugin, and it kind of talks about appending. 我正在使用该Masonry插件,并且有关附加的讨论。
I thinks you need to refactor your code as: 我认为您需要将代码重构为:
var thiz = this;
$.ajax({
method:"get",
url:"/wall",
data:"ajax=1",
beforeSend:function(){},
success:function(html){
$("#grid_mason").append(html); //Add the next boxes to the Grid.
$(thiz).masonry({
appendedContent: $( html ),
animate:false,
resizeable:false});
});
}
});
If you have the masonry applied to #grid_mason
then try changing the code from 如果您将砌体应用于#grid_mason
尝试从以下位置更改代码
$("#grid_mason").append(html);
$(thiz).masonry({ appendedContent: $( html ), animate:false, resizeable:false });
To this 对此
$("#grid_mason").append(html)
.masonry({ appendedContent: $( html ), animate:false, resizeable:false });
Not sure I can suggest anything else without seeing more of the code. 不知道我是否可以建议其他任何内容而无需查看更多代码。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.