gpt4 book ai didi

javascript - (#601) 解析器错误 : unexpected end of query - Javascript FB. API

转载 作者:行者123 更新时间:2023-12-02 19:51:52 27 4
gpt4 key购买 nike

我有一些代码在一个月前工作......现在,当我检查它时,它不起作用。我看到了问题所在,控制台显示:“查询意外结束”

我已经在 Graph API 工具上检查了这个查询,它有效!我使用与我的“应用程序”相同的权限。

这是 FQL 查询:

SELECT uid,name FROM user WHERE uid IN ( SELECT uid2 FROM friend WHERE uid1 = me() ) ORDER BY name

这是完整的代码:

// This code is in an html file
window.fbAsyncInit = function() {
FB.init({
appId : '226472757418610',
status : true,
cookie : true,
oauth : true,
xfbml : true
});
}
...
// this code is in a javascript file and the user is correctly logged in
FB.api('/fql?q=SELECT uid,name FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me()) ORDER BY name', function(amigos) {
console.log(amigos)
// it prints the message above
});

我看不到任何错误!你能建议我的代码可能有什么问题吗?

最佳答案

如果任何人对“查询意外结束”有任何问题,您可以尝试更改此代码:

FB.api('/fql', { q:{"query1":"yourQuery"} }, function(response) {
// the response is different:
var x = response.data[0].fql_result_set;
});

虽然这不是最好的解决方案。

更新:q不一定是一个对象。它可能只是您的查询,结果可以通过response.data获取

关于javascript - (#601) 解析器错误 : unexpected end of query - Javascript FB. API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9202701/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com