Here is my code to query all comments for post_id. When i run it. i cannot get text or id of comment.
var queryTemplate = "SELECT text FROM comment WHERE post_id ='1756044141_155528821125475'";
var u2 = FB.Data.query(queryTemplate);
FB.Data.waitOn([u2], function(args) {
//console.log(args[0]);
alert(args)
});
for console.log(args[0]), it show me empty [].
for alert(args), it show me empty also.
i use this queryTemplate in facebook test console, it work! But when i use in my website, it doesn’t work.
here is facebook console show me
[ {
“text”: ” น่ากลัว ” }, {
“text”: “เผลอๆเงินเดือนพวกนี้อาจสูงกว่าวิศวกรหรือหมออีกก็เป็นได้…..
^^”” }, {
“text”: ” อาจช่าย คงจะแพงน่าดู” }, {
“text”: “ดีนะรอดมาได้ ” }, {
“text”: “@Chalita จริงไหม เรียนวิศวะ
ในมหาลัยยังไม่เสี่ยงตายเท่าเรียนช่างกลเลย@Mat ยินดีด้วยนะ
ได้ข่าวว่าตอนนี้รถคุณแรงน่าดูเลยหนิ
5555+” }, {
“text”: “อัลฮัมดุลิ้ลลาห์ฮ่าๆๆ
ก็ได้บรรดานักแข่งอย่างพวกคุณๆอะแหละ
มาฝึกปรือให้ฮ่าๆๆๆ” }, {
“text”: “Perfect ตลอด” }, {
“text”: “ได้ข่าวว่าจะซื้อเหรียญนี่คุณรีม
ฮ่าๆๆ” }, {
“text”: ” เรียกนาละกันนะ วิศวะปลอดภัยกว่าจิง
ทำไมต้องฆ่ากันด้วยเรียนเพื่อเอาวิชาความรู้นะจิงป่ะ
” }, {
“text”: “ถูกกกกก” }, {
“text”: “ช่าย บางที รร พวกช่างอาจต้องปิดตัวลง
เพราะปัญหาเหล่านี้คงแก้ยาก” } ]
here is my website show
[]
I already fix it
Just pust Fb query in FB.getsession such as
FB.getLoginStatus(function(response) {
if (response.session) {
var post_id = '1756044141_155528821125475';
var queryTemplate = "SELECT comments FROM stream WHERE post_id ='1756044141_155528821125475'";
var u2 = FB.Data.query(queryTemplate);
FB.Data.waitOn([u2], function(args) {
console.log(args[0]);
//alert(args)
});
} else {
// no user session available, someone you dont know
}
});
That’s why firebug was invented. Once you installed it you can do
and see everything what is returned. You would need to do something like
response[0].textto get what you need.Also there is nothere is, my badidfield in thecommenttable.