I'm trying to make my HTML and JavaScript code really organized so i'm all the JavaScript code is in different files.
When trying to insert the code into the HTML page it doesn't work:
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="https://www.facebook.com/2008/fbml">
<body>
<div id="fb-root"></div>
<script src="facebook.js" type="javascript" ></script>
</body>
</html>
this is facebook.js:
window.fbAsyncInit = function() {
// init the FB JS SDK
FB.init({
appId : 'APP_ID', // App ID from the app dashboard
status : true, // Check Facebook Login status
xfbml : true // Look for social plugins on the page
});
//subscribe event for facebook login
FB.Event.subscribe('auth.statusChange', function(response) {
alert(response.status);
});
};
// Load the SDK asynchronously
(function(d, s, id){
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s);
js.id = id;
js.src = "//connect.facebook.net/en_US/all.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
When i'm using the exact same script inside my html - it works great.. what am i doing wrong ?
text/javascript.