我有一个示例代码:
function initFB() {
var flag;
window.fbAsyncInit = function() {
FB.init({appId: 'zzzzzz', status: true, cookie: true, xfbml: true});
var flag;
FB.getLoginStatus(function(response) {
if (response.status === 'connected') {
flag = 1;
} else if (response.status === 'not_authorized') {
flag = 2;
} else {
flag = 3;
}
});
};
return flag;
}
var flag = initFB();
alert(flag);
=> 结果是undefined
,无法在 facebook 功能中设置标志?,如果没有,如何解决?