Mike 3 vuotta sitten
vanhempi
commit
6ad3f7d860
1 muutettua tiedostoa jossa 5 lisäystä ja 13 poistoa
  1. 5 13
      desktop11/index.html

+ 5 - 13
desktop11/index.html

@@ -65,16 +65,9 @@ function testAPI() {                      // Testing Graph API after login.  See
     console.log('Welcome!  Fetching your information.... ');
        
     FB.api('/me/?fields=id,name,email', function(response) {
-        console.log('FB成功登入: ' + JSON.stringify(response));
-
-        if (response.name) {
-            // 設定欄位預設值
-            $('#email').text(response.email);
-            $('#name').text(response.name);
-
-            // 隱藏FB登入按鈕
-            $('#fb_login').hide();
-        }
+        console.log('成功登入: ' + JSON.stringify(response));
+        console.log('Successful login for: ' + response.name + ', email = ' + response.email + ', id = ' + response.id);
+        document.getElementById('status').innerHTML = 'Thanks for logging in, ' + response.name + '!';
     });
 }
 </script>
@@ -416,9 +409,8 @@ function testAPI() {                      // Testing Graph API after login.  See
                                 <img src="./img/logo/facebook.webp" alt="">
                                 使用FB填入信箱與姓名
                             </div> -->
-                            <div id="#fb_login">
-                                <fb:login-button scope="public_profile,email" onlogin="checkLoginState();">使用FB填入信箱與姓名</fb:login-button>
-                            </div>
+                            
+                            <fb:login-button scope="public_profile,email" onlogin="checkLoginState();">使用FB填入信箱與姓名</fb:login-button>
                             <div id="status"></div>
                             
                             <input type="text" name="email" id="email" placeholder="請輸入信箱" required>