ยินดีต้อนรับคุณ, บุคคลทั่วไป กรุณา เข้าสู่ระบบ หรือ ลงทะเบียน

เข้าสู่ระบบด้วยชื่อผู้ใช้ รหัสผ่าน และระยะเวลาในเซสชั่น

ThaiSEOBoard.comพัฒนาเว็บไซต์Programmingรบกวนดูโค้ต Js ของ facebook ให้หน่อยครับ
หน้า: [1]   ลงล่าง
พิมพ์
ผู้เขียน หัวข้อ: รบกวนดูโค้ต Js ของ facebook ให้หน่อยครับ  (อ่าน 910 ครั้ง)
0 สมาชิก และ 1 บุคคลทั่วไป กำลังดูหัวข้อนี้
jamess2600
ก๊วนเสียว
*

พลังน้ำใจ: 25
ออฟไลน์ ออฟไลน์

กระทู้: 354



ดูรายละเอียด เว็บไซต์
« เมื่อ: 16 มิถุนายน 2018, 15:13:06 »

อันนี้ใช้ได้ปกติ แต่ผมอยากเพิ่มให้มัน ดึงข้อมูลได้หลาย ID มากขึ้น

โค๊ด:
privateObj.callFB = function(newConfig){
FB.api("/"+newConfig.pagename, {
access_token : newConfig.token,
"fields" :"picture{url},name,cover,fan_count,link,posts.limit("+newConfig.feedlimit+"){attachments, likes.limit(0).summary(true), message, created_time, link}"
},
function (response) {
if (!response.error) {
newConfig.onLoad(privateObj.formatResponse[newConfig.format](response, newConfig), newConfig.format, response);
} else {
newConfig.onLoad(response.error, 'json');
}
}
);
};

ผมเลยปรับไปเป็น ids ดังนี้ครับ แต่มันไม่ทรายสามารถใช้งานได้ครับ รบกวนพี่ ๆ หน่อยนะครับ

โค๊ด:
privateObj.callFB = function(newConfig){
FB.api("/",{
access_token : newConfig.token,
"ids" : +newConfig.pagename,
"fields" :"picture{url},name,cover,fan_count,link,posts.limit("+newConfig.feedlimit+"){attachments, likes.limit(0).summary(true), message, created_time, link}"
},
function (response) {
if (!response.error) {
newConfig.onLoad(privateObj.formatResponse[newConfig.format](response, newConfig), newConfig.format, response);
} else {
newConfig.onLoad(response.error, 'json');
}
}
);
};

บันทึกการเข้า

หน้า: [1]   ขึ้นบน
พิมพ์