So, I'm trying to access twitter's REST API and get the tweet screen name. I feel that my code will be the best explanation:
I call the 'screenName' method from isClient ():
'click button': function () { Meteor.call('screenName', function(error,result) { if (error) { console.log(error); } else { window.alert(result); } } ) }
And for some reason, the method returns undefined when it actually registers the screen name of the twitter account on the console.
Meteor.methods({ 'screenName': function() { T.get('search/tweets', { q:'#UCLA', count:1 }, function(err,data,response) { console.log(data.statuses[0].user.screen_name); return data.statuses[0].user.screen_name; } ) }
If anyone can help me with this. Thank you very much!
source share