[問題]facebook用jQuery

看板Ajax作者 (小 i)時間15年前 (2010/08/19 17:03), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
最近小弟遇到了幾個問題 就是現在再用jQuery寫facebook的登入 現在就是用本尊的帳號測試都還沒有問題 但是用其他帳號的時候 在登入的狀態時 卻還是抓不到使用者的session 在未登入的狀態下 也無法進入登入頁面 請請板上的大大指點迷津 程式碼: <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>Connect JavaScript - jQuery Login Example</title> </head> <body> <h1>Connect JavaScript - jQuery Login Example</h1> <div id="user-info" style="display: none;"></div> <script src="" rel="nofollow">http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"> </script> <div id="fb-root"></div> <script src="" rel="nofollow">http://connect.facebook.net/en_US/all.js"></script> <script> // initialize the library with the API key FB.init({ apiKey: 'xxxxxxxxxxxxxxxxxxx' }); // fetch the status on load FB.getLoginStatus(handleSessionResponse); check(); function check() { FB.getLoginStatus(function(response) { if (!response.session) { FB.login(handleSessionResponse); } else { alert("load info"); FB.api ( { method: 'fql.query', query: 'SELECT name, pic FROM profile WHERE id=' + FB.getSession().uid }, function(response) { var user = response[0]; $('#user-info').html('<img src="' + user.pic + '">' + user.name).show('fast'); } ); }; }); }; function handleSessionResponse(a) { // if we dont have a session, just hide the user info if (!a.session) { clearDisplay(); return ; } alert("have session"); } -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.127.220.20 ※ 編輯: iii125 來自: 140.127.220.20 (08/19 17:04)
文章代碼(AID): #1CRFDZUS (Ajax)
文章代碼(AID): #1CRFDZUS (Ajax)