我想将变量传递给js函数:
<script>
(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/de_DE/all.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
// async init once loading is done
window.fbAsyncInit = function() {
FB.init({appId: 1234567890987, status: false});
};
function gogogo(data) {
FB.ui({
method: 'feed',
link: data.url,
picture: data.picture,
name: data.title,
//caption: data.caption,
description: data.description
});
}
获取此处并显示除描述之外的所有内容:
<%= link_to image_tag('icons/social-fb.png'),'#', :onclick=>"gogogo({ url:'#{request.original_url}',title:'#{content.title}',picture:'#{PICTURE_PATH+content.tg_medias.first.media.url(:big)}', description:'#{content.description}' }) ;return false;" %>
content.description不起作用.. 感谢