I want to apply facebook login to my web application.
In order to split different parts, navigation bar, sidebar and content, into different php files, I need to use multiple
include('xxx.php');
in index.php
The script of facebook SDK is in index.php. When I use getElementById() in the script, it cannot find the element in navigation.php. The javascript can only find the element I needed when remove include('xxx.php'); and move everything from xxx.php to index.php at the line that I removed include('xxx.php');
If I want to keep using include('xxx.php');, how can I use getElementById() to find the elements in xxx.php when I call the function in index.php?
(I guess this kind of question has been asked before but I don't know how to call this kind of problem such that I don't know how to search for the solution)
Here are the codes in index.php:
<body>
<script>
...
function statusChangeCallback(response) {
console.log('statusChangeCallback');
console.log(response);
if (response.status === 'connected') {
// Logged into your app and Facebook.
document.getElementById('container').innerHTML = 'Please log ' +
'into Facebook.';
}
...
</script>
include('xxx.php');
The id container is in xxx.php.
include. give more info