0
我想補充comment.create
和comment.remove
到頁面多FB.Event.subscribe不會閃光,但單不
如果我用下面的,一切正常:
window.fbAsyncInit = function(){
FB.Event.subscribe('comment.create', function(response){
$.ajax({
type: "POST", // form method
url: "/pages/includes/add_fb_comments.php",// destination
data: "url=" + encodeURIComponent(response.href) + "&id=<?=$id?>&action=add",
cache: false,
success: function(){
alert('Success' + encodeURIComponent(response.href) + response.commentID);
}
});
});
};
但是,然而何我添加以下,無火災,阿賈克斯不火,因此沒有成功的消息
FB.Event.subscribe('comment.remove', function(response){
$.ajax({
type: "POST", // form method
url: "/pages/includes/add_fb_comments.php",// destination
data: "commentID=" + response.commentID + "&action=remove",
cache: false,
success: function(){
alert('removed comment: ' response.commentID);
}
});
});
我一樣window.fbAsyncInit = function(){
我內都嘗試已經試過了分開window.fbAsyncInit = function(){
我甚至嘗試完全分開<script></script>
但他們根本不開火。
這是一個已知的問題?我不能相信這是肯定這些總是存在在一起
任何想法?
這是完全實際的代碼我試圖:
<div class="fb-comments" data-href="<? echo curPageURL(); ?>" data-num-posts="4" data-width="578" mobile="false"></div>
<script>
window.fbAsyncInit = function(){
FB.Event.subscribe('comment.create', function(response){
$.ajax({
type: "POST", // form method
url: "/pages/includes/add_fb_comments.php",// destination
data: "url=" + encodeURIComponent(response.href) + "&id=<?=$id?>&action=add",
cache: false,
success: function(){
alert('Success' + encodeURIComponent(response.href) + response.commentID);
}
});
});
};
window.fbAsyncInit = function(){
FB.Event.subscribe('comment.remove', function(response){
$.ajax({
type: "POST", // form method
url: "/pages/includes/add_fb_comments.php",// destination
data: "commentID=" + response.commentID + "&action=remove",
cache: false,
success: function(){
alert('removed comment: ' response.commentID);
}
});
});
};
</script>