How to use fb.data.query to get friends info?
生活随笔
收集整理的這篇文章主要介紹了
How to use fb.data.query to get friends info?
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
參考代碼1:
?
query.wait(function(rows)?{
var?loginData?=?{fb_uid:?rows[0].uid,?
????????????????first_name:?rows[0].first_name,
????????????????last_name:?rows[0].last_name,
????????????????employer:?rows[0].work[0].employer.name,
????????????????position:?rows[0].work[0].position.name
????};
}
?
?
參考代碼2:
?
?
var?query1?=?FB.Data.query('select?name,uid,birthday,contact_email,birthday_date,sex,status,current_location,wall_count?from?user?where?uid=me()');?///通過uId得到用戶資料????????????????//var?query2?=?FB.Data.query('select?uid2?from?friend?where?uid1=me()'); ?????????????? ?//當uid1=uid2時,為朋友,通過uid1=me時,得到uid2
????????????????query1.wait(function(msg)?{
????????????????????if?(msg[0].sex?==?"")
????????????????????{
????????????????????????sex?=?"u";
????????????????????????sex1?=?3;
????????????????????}
????????????????????else?if?(msg[0].sex?==?"male")
????????????????????{
????????????????????????sex?=?"m";
????????????????????????sex1?=?1;
????????????????????}
????????????????????else
????????????????????{
????????????????????????sex?=?"f";
????????????????????????sex1?=?0;
????????????????????}
????????????????????if?(msg[0].current_location?!=?null)?{
????????????????????????city?=?msg[0].current_location.city?||?"null";
????????????????????????country?=?msg[0].current_location.country?||?"null";
????????????????????????state?=?msg[0].current_location.state?||?"null";
????????????????????????zip?=?msg[0].current_location.zip?||?"null";
????????????????????}
????????????????????count?=?msg[0].length?||?0;
????????????????????if?(msg[0].contact_email?!=?null)?{
????????????????????????contact_email?=?msg[0].contact_email;
????????????????????}
????????????????????//給PHP傳統計
????????????????????if?(window.location.search.indexOf("&installed=1")?!=?-1)
????????????????????{
????????????????????????$.ajax({
????????????????????????????url:that.Config.statisticsPHPUrl,
????????????????????????????data:{"sex":sex1,"email":contact_email},
????????????????????????????success:function(data)?{
????????????????????????????????if?(data.result)?{?//成功
????????????????????????????????}?else?{//不成功
????????????????????????????????}
????????????????????????????}
????????????????????????});
????????????????????}
????????????????});
?
?
?
?
?
?
?
轉載于:https://www.cnblogs.com/xiaochaohuashengmi/archive/2011/07/04/2097561.html
總結
以上是生活随笔為你收集整理的How to use fb.data.query to get friends info?的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 光与夜之恋怎么和陆沉约会
- 下一篇: GridView 利用AspNetPag