I'm trying to get the events created on the facebook page for a public radio show to appear on the show's website.
I'm trying to use the Javascript SDK to query the events being attended by the dummy admin user that I use to manage the public page in the hopes that I can use that uid to access the event information and display it. I've got one event set up and the user is currently the only one attending it, but when I query the event_member table nothing comes up. I can get the user name and the event name to appear, but not any relationship between the two.
I just started with fb development in the last couple days and the API documentation is short on examples so I'm having some problems. I'm probably using the wrong method for accessing the dataset returned since eventually I'm going to have to loop through multiple rows, but for now I'm just trying to get some basic information printed out so I know that much works before I move on.
Here's my app so far. I can only get anything to display when I remove the third event_member query. Any input is most appreciated!
<h1>Here On Earth</h1>
<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
window.fbAsyncInit = function() {FB.init({appId: '166023043414927', status: true, cookie: true, xfbml: true});};
var user_id = "535781350";
var query = FB.Data.query('select name, uid from user where uid={0}', user_id);
query.wait(function(rows) {document.getElementById('name').innerHTML ='Your name is ' + rows[0].name;});
var event_id = "165995390077907";
var query = FB.Data.query("select name from event where eid={0}", event_id);
query.wait(function(rows) {document.getElementById('event').innerHTML ='Your event is ' + rows[0].name;});
var query = FB.Data.query("select name from user where uid in (select uid from event_member where eid={0})", event_id);
query.wait(function(rows) {document.getElementById('event_member').innerHTML = rows[0].name + ' is attending your event.' ;});
</script>
Name:<div id="name"></div>
Event:<div id="event"></div>
Event Member:<div id="event_member"></div>