2012-06-29 54 views
1

我試圖在網頁上顯示用戶的Facebook通知,就像它在Facebook本身顯示的一樣。然而,我一直在堅持如何讓這個查詢到Facebook API,然後更新網頁。顯示當前的Facebook通知

我創建一個查詢,應該有希望回到我所需要的:

SELECT notification_id, sender_id, title_html, body_html, href 
FROM notification 
WHERE recipient_id=<uid> 
AND is_unread = 1 
AND is_hidden = 0 

我卡上,並不能真正找到有關如何我可以給使用JavaScript此查詢什麼事情?我是否必須向返回響應或其他內容的單獨PHP頁面發出AJAX請求?

回答

1

試試這個:

FB.api({ 
    method: 'fql.query', 
    query: 'SELECT notification_id, sender_id, title_html, body_html, href' 
     + ' FROM notification' 
     + ' WHERE recipient_id=' + uid 
     + ' AND is_unread = 1' 
     + ' AND is_hidden = 0' 
}, function(response){ 
    console.log(response); 
}); 
+0

偉大的工作,謝謝! – sailboatlie