Reputation: 346
I'm trying to display a user's Facebook notifications on a web page much like how it's displayed in Facebook itself. However, I'm stuck on how exactly I can make this query to the Facebook API and then update the web page.
I've created a query that should hopefully return what I need:
SELECT notification_id, sender_id, title_html, body_html, href
FROM notification
WHERE recipient_id=<uid>
AND is_unread = 1
AND is_hidden = 0
The thing I'm stuck on and can't really find anything about how I can send this query using JavaScript? Do I have to make an AJAX request to a separate PHP page that returns the response or something else?
Upvotes: 1
Views: 253
Reputation: 10114
Try this:
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);
});
Upvotes: 1