0
這是我擁有的mvc 3視圖的主體。這是關於我想創建的Facebook應用程序。預期的結果是有一個彈出窗口顯示用戶輸入應用程序的名稱。當我運行應用程序時,沒有任何反應,所以沒有執行代碼。那麼這個錯誤是什麼?JavaScript未按預期執行 - Facebook JavaScript SDK
<body>
<div id="fb-root" style="display: none"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId: 'My app ID', // Application ID provided by Facebook
status: true, // Check login status
cookie: true, // Enable cookies to allow the server access the session
xfbml: true // parse XFBML
});
// Other initialization code here
FB.api('/me', function (response) {
alert('Your name is ' + response.name);
});
};
// Load Facebook JavaScript SDK asynchronously
(function (d) {
var js, id = 'facebook-jssdk', ref = d.getElementByTagName('script')[0];
if (d.getElementById(id)) {
return;
}
js = d.createElement('script');
js.id = id;
js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
ref.parentNode.insertBefore(js, ref);
}(document));
</script>
@RenderBody()
非常感謝你。真正有用的鏈接! –
歡迎來到SO。在不總結重點的情況下,您應該避免鏈接到文章。如果網頁被刪除或不可用,那麼這個答案不再有用。 – Scott