For some weird reason my function isn't working and I was wondering what im missing, I'll try to explain.
When you first load the website it needs to load a function, after this it will start loading into divs.
Code in my div (Also tried: body onload or in the header)
So i stripped down the complete function to test:
The code above will display something like:
or
This is based on what page you are at,
But it doesn't work, when I delete the "var <?php echo $write_page['1']; ?>;"
I get the following: "ReferenceError: home is not defined"
The rest of the website works fine, its not that its waiting for jquery or so..
When i click on a existing tab, which does the same (kinda), works fine.
I also tried replacing loadthisframe with loadpageframe but there is where the problem started so i'm trying to strip down till i find the issue.
When you first load the website it needs to load a function, after this it will start loading into divs.
Code in my div (Also tried: body onload or in the header)
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
| <script type="text/javascript">
<?php
if(empty($write_page['1'])) {
?>
loadthisframe(home);
<?php
}
else
{
?>
var <?php echo $write_page['1']; ?>;
loadthisframe(<?php echo $write_page['1']; ?>);
<?php
}
?>
</script> |
So i stripped down the complete function to test:
code:
1
2
3
| function loadthisframe(loadthisframe) {
console.log("load page");
} |
The code above will display something like:
code:
1
2
3
| <script type="text/javascript"> loadthisframe(home); </script> |
or
code:
1
2
3
4
| <script type="text/javascript"> var contact; loadthisframe(contact); </script> |
This is based on what page you are at,
But it doesn't work, when I delete the "var <?php echo $write_page['1']; ?>;"
I get the following: "ReferenceError: home is not defined"
The rest of the website works fine, its not that its waiting for jquery or so..
When i click on a existing tab, which does the same (kinda), works fine.
code:
1
2
3
4
5
| $('#tabhome').bind('click', function(event) {
var home = "home";
loadpageframe(home);
window.history.pushState("object or string", "Title", "/");
}); |
I also tried replacing loadthisframe with loadpageframe but there is where the problem started so i'm trying to strip down till i find the issue.