在另一个函数中没有获取数据形式的java函数 [英] Not getting data form java function in another function
问题描述
我试图从Facebook取得用户名,所以我可以在以后的阶段使用它我已经在FB Root div中嵌入了下面的代码。
我知道检索工作!但是我不能将它传递给函数returndata我相对新的JavaScript可以请你帮我吗?我已经尝试了所有的东西。
$ $ p $ $ $ $ $ $ FB.api('/ me?fields = username',function(response)
{
GetID = response.username
return GetID})
函数returndata(){
get = response
return get
};
您的returndata方法应该有一个参数,您应该从Facebook回调中调用它:
FB.api('/ me?fields = username',function(response){
returndata(response.username);
});
函数returndata(用户名){
//在这里可以做任何你需要的东西,可以使用用户名
};
If you view this question thank you in advance!, I am working on pulling data from Facebook.
I am trying to pull the username from Facebook so i can use it in a later stage I have embedded the following code in the FB Root div.
I know the retrieve works! however i am not able to pass it on to the function "returndata" I am relative new to javascript could you please help me out? i have tried everything
FB.api('/me?fields=username', function(response)
{
GetID = response.username
return GetID})
function returndata(){
get = response
return get
};
Your returndata method should take an argument, and you should call it from the facebook callback:
FB.api('/me?fields=username', function(response) {
returndata(response.username);
});
function returndata(username) {
// do whatever you need here, with access to username
};
这篇关于在另一个函数中没有获取数据形式的java函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!