我正在创建 facebook 应用程序,用户可以在其中获取朋友列表中所有朋友的公司名称
FB.api('/me', function(response) {
var query = FB.Data.query('select name,work,work_history,pic_square
from user where uid IN (SELECT uid2 FROM friend WHERE uid1={0})', response.id)
query.wait(function(rows){
var data = "";
for (var i = 0; i < rows.length;i++) {
data += rows[i].name + " => " +'<img src="' +rows[i].pic_square + '" alt="image" />' + "===> ";
if(rows[i].work[i]||rows[i].work_history[i]) {
data+=rows[i].work_history[0].company_name+ "<br/>";
}
data += "<br />";
}
document.getElementById('location').innerHTML = data;
});
});
}