English 中文(简体)
帮我在Facebook Javascript SDK中构建一个函数
原标题:Give me a hand in building a function in Facebook Javascript SDK

我正在尝试构建一个脸书应用程序,在这个应用程序中,我需要提取不喜欢某个页面的朋友的id。

到目前为止,我已经使用下面的函数提取了我所有的朋友id。

我需要生成一个代码来构建另一个API,该API使用我朋友的id来获得他们的赞。。

function loadFriends()
{
    //get array of friends
    FB.api( /me/friends , function(response) {
        console.log(response);
 var testdiv = document.getElementById("test");
        for(i=0;i<response.data.length;i++)
            {
                 testdiv.innerHTML +=  response.data[i].id +  <br/>  ;
            }
    });
}

我需要得到这样的东西:

 FB.api( /response.data[i].id/likes , function(response) {

我该怎么做?

问题回答

你可以这样做

FB.api({
            method:  fql.query ,
            query:  SELECT first_name, last_name, pic_big FROM USER WHERE uid IN ( SELECT uid FROM page_fan WHERE page_id=  + page_id +   AND uid IN ( SELECT uid2 FROM friend WHERE uid1 = me() ) ) 
        }, function(response){

//you get the friends who liked this page. now you can remove these ids from friends lists to get you result.
});




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签