2011-06-20 23 views
1

我想从我的应用程序使用javascript FB.api(url,success function)搜索Facebook API,并且返回的JSON对象包含错误:“搜索查询不支持此连接。 “Facebook搜索API不可信连接

我使用的网址是:“https://graph.facebook.com/search?q=Bamboo &类型=页面& =的access_token”,当我在浏览器中测试它其中工程

为什么我的搜索不受支持?

回答

2

问题是你的网址。您只需将图形api命令放入url参数中,因此不应包含“https://graph.facebook.com”。

对于使用搜索调用,

var urlCall = "https://stackoverflow.com/search?q=Bamboo&type=page&access_token="; 
FB.api(urlCall, function(response) { 
    //you code to execute  
}); 

,而不是下面

url = "https://graph.facebook.com/search?q=Bamboo&type=page&access_token=" 
+0

这解决了我的问题。但是这个方法怎么样:$ .ajax({url:'https://graph.facebook.com/search?q=Bamboo&type=page',sucess:function(response){alert(response);}});这也不起作用。 – Alex

+0

我不熟悉$ .Ajax,也许jquery?当我点击你的链接时,我得到了错误:“消息”:“不支持的类型,页面”。“然后,我将这个单引号从type =页面中取出,然后我得到了一个json响应。也许是一个错字?可能试试这个:$ .ajax({url:“graph.facebook.com/search?q=Bamboo&type=page”;,; sucess:function(response){alert(response);}}); ??? – guiomie

+0

我试过用双引号,但没有得到任何回应。这很好理解为什么:D – Alex