0
我想在用戶在fb上共享帖子時更新我的數據庫。我正在使用Facebook SDK進行JAVASCRIPT。如何更新mysql中的數據當用戶使用Facebook SDK for JavaScript在Facebook上發佈帖子時
我的代碼是: -
<script>
document.getElementById('shareBtn').onclick = function() {
FB.ui({
method: 'share',
display: 'popup',
href: 'url goes here',
}, function(response){
if (response && response.post_id) {
//ajax code goes here for database update
} else {
alert('oops post was not published');
}
});
}
</script>
按鈕代碼 -
<div class="fb-share-button"
data-href="url goes here"
data-layout="button" data-size="large">
</div>
我能夠分享的信息,但如何更新MySQL的數據時,用戶成功股吧發帖
看到我的答案。這個btw的用例是什麼?爲什麼你要更新數據庫,如果用戶分享了一些東西? – luschn
@luschn其實我正在一個項目中,當用戶成功分享帖子時獎勵用戶 –
這甚至不允許......你不能以任何方式獎勵用戶分享。在繼續之前,您應該閱讀[平臺策略](https://developers.facebook.com/policy)。 – CBroe