可能性の重複:
How to render a plugin added dynamically?Facebookのプラグインを更新するには?
これは私のcodeです:
HTML
<div id="fb-root">
<fb:like href="www.google.it" send="false" layout="button_count" width="auto" show_faces="true"></fb:like>
<div id="newFB"></div>
<a href="#" id="showFacebook">Add new "I Like" and refresh</a>
jQueryの
function renderFB() {
(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/it_IT/all.js#xfbml=1"; fjs.parentNode.insertBefore(js, fjs); } (document, 'script', 'facebook-jssdk'));
}
renderFB();
$("#showFacebook").click(function() {
$('#newFB').html('<fb:like href="www.google.it" send="false" layout="button_count" width="auto" show_faces="true"></fb:like>');
renderFB();
});
ページロード時にすべてのFBプラグインをロードします。その後、新しいプラグインを追加して再レンダリングします。または、可能であれば、最後に挿入されたもののみ。
可能ですか?そして私はそれをどうすればいいのですか?