在FB.init()之前调用的间歇FB.login()

时间:2017-04-26 06:24:33

标签: javascript facebook

我试图在我的项目中实现Facebook连接,并且它在90%的时间都有效。我正在运行以下代码启动FB SDK

<div class="alert alert-warning alert-dismissable">
   <a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
   <strong>Warning!</strong>
</div>

当它工作时,我的日志window.fbAsyncInit = function() { // init the FB JS SDK console.log("initing") FB.init({ appId : app_id, status : true, xfbml : true }); FB.getLoginStatus(function(response) { console.log("getting login status", response) if (response.status === 'connected') { canEnter = 1; var uid = response.authResponse.userID; $.ajax ({ type: "POST", url: siteurl+"/Introduction/ajax_facebook", data: {'facebook_user_id': uid}, success: function(data) { } }); } }); }; 会运行,但每次都不会被调用,当我点击使用Facebook按钮登录时,我收到错误console.log("getting login status", response)

FB.init似乎永远不会完成。为什么会这样?

0 个答案:

没有答案