I'm trying to use the Fb PHP SDK to execute different Js document.getElementById innerHTML functions, depending on whether the user is logged in to Fb or not. For some reason the function won't work for me. I know my API connection is successful, and Javascript can be inserted here, as I can call alternative alert functions ("you are logged in" :you are not logged in") in this way. But the getElementById function won't work. I've tried moving the script to the body etc, nothing working.
Any ideas? It's probably a rookie question, but I'd love it if there was a simple solution! Here's the essential code below...
<?php if ($user_profile) { ?>
<script>
document.getElementById('test1').innerHTML = "<p>You ARE logged in</p>";
</script>
<?php } else { ?>
<script>
document.getElementById('test1').innerHTML = "You are NOT logged in";
</script>
<?php } ?>
</head>
<body>
<div id="test1">
</div>