Reputation: 2040
I am using Freebase JS api to fetch topic details. This is a simple function for that:
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.
}
}
On debugging I see, it goes to onFinalSuccess and then nothing! Skips to the end. What's wrong here?
NOTE I'm using it in conjuction with YT API. It's a sepearte function though. Can it a problem?
Upvotes: 1
Views: 406
Reputation: 4296
You are refering to the call back function before it's assigned. Try:
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.
});
}
Upvotes: 1