您好我尝试在facebook上分享我的帖子。但它显示未定义参考错误Share_Prompt()。 这是我的Facebook分享代码。 错误:未捕获的ReferenceError:未定义share_prompt 在HTMLAnchorElement.onclick
<a class="btn-style-1 style-big" onclick="share_prompt()" style="background-color: #3b5998;float: right;">Share on Facebook</a>
<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/en_US/sdk.js#xfbml=1&version=v2.8&appId=xxx";
fjs.parentNode.insertBefore(js, fjs);
} (document, 'script', 'facebook-jssdk'));</script>
<script>
window.fbAsyncInit = function() {
FB.init({
appId: 'xxx',
status: true,
cookie: true,
xfbml: true,
version: 'v2.8'
});
};
function share_prompt()
{
FB.ui(
{
method: 'feed',
name: '<?php echo $job_title ?>',
link: 'http://fbfunzone.com/jobPortalplus/jobsdetail.php?id=<?php echo $jid ?>',
picture: 'http://xyza.com/xxxx/images/blog/blog-detail-img.jpg',
caption: 'www.xxx.com',
description: '<?php echo $head_line ?>',
author : 'xxx',
display: 'iframe',
message: ''
},
function(response) {
if (response && response.post_id) {
} else {
// alert('Post was not published.');
}
}
);
}
</script>