Javascript函数为所有用户检索信息
我有这个功能,可以帮助我检索我的朋友id,但我似乎无法让它用于检索一个朋友的id。我需要做一个循环来获取所有的朋友id 你能帮我查一下这个密码吗Javascript函数为所有用户检索信息,javascript,facebook,facebook-graph-api,Javascript,Facebook,Facebook Graph Api,我有这个功能,可以帮助我检索我的朋友id,但我似乎无法让它用于检索一个朋友的id。我需要做一个循环来获取所有的朋友id 你能帮我查一下这个密码吗 function(response) { console.log(response); var testdiv = document.getElementById("test"); testdiv.innerHTML = ( response[0].uid2 ); } 只需迭代响应: 嘿,谢谢。。是这样
function(response) {
console.log(response);
var testdiv = document.getElementById("test");
testdiv.innerHTML = (
response[0].uid2
);
}
只需迭代响应:
嘿,谢谢。。是这样的吗?对于i=0;我的老兄,这不是借口,但我对javascript是新手,就像真的很新。。如果我像这样粘贴它,它将不起作用..我这样做了,但我没有输出。。是因为我做错了吗?。。。unctionresponse{console.logresponse;var testdiv=document.getElementByIdtest;var newhtml=document.getElementByIdtest1;for i=0;Isolve:非常感谢!对不起,你一定受够了像我这样的新手了,:
for (i=0; i<=response.length; i++) {
var uid2 = response[i].uid2;
// do what you need to with uid2
}
function(response) {
console.log(response);
var testdiv = document.getElementById("test");
var newhtml = "";
for (i=0; i<=response.length; i++) {
newhtml += response[i].uid2;
}
testdiv.innerHTML = newhtml;
}