Javascript Google API gapi.cliet.request不工作
我正在使用Freebase JS api获取主题详细信息。这是一个简单的函数:Javascript Google API gapi.cliet.request不工作,javascript,jquery,json,google-chrome,google-api,Javascript,Jquery,Json,Google Chrome,Google Api,我正在使用Freebase JS api获取主题详细信息。这是一个简单的函数: function simpleTopicDetail(topicIds){ path = 'freebase/v1/topic' + topicIds; var opts = { 'method': 'GET', 'path': path, 'params': {'filter':'/common/topic/articl
function simpleTopicDetail(topicIds){
path = 'freebase/v1/topic' + topicIds;
var opts = {
'method': 'GET',
'path': path,
'params': {'filter':'/common/topic/article'}
};
var request = gapi.client.request(opts);
request.execute(onFinalSuccess);
var onFinalSuccess = function(data){
console.log(data);
//do something with data
//parsing JSON resp to get a node value.
}
}
在调试时,我看到,它进入onFinalSuccess,然后什么都没有!跳到最后。这里怎么了注意我将它与YT API结合使用。这是一个单独的函数。这可能是个问题吗?在分配回调函数之前,您正在引用该函数。 尝试:
function simpleTopicDetail(topicIds){
path = 'freebase/v1/topic' + topicIds;
var opts = {
'method': 'GET',
'path': path,
'params': {'filter':'/common/topic/article'}
};
var request = gapi.client.request(opts);
request.execute(function(data){
console.log(data);
//do something with data
//parsing JSON resp to get a node value.
});
}