I've a problem with disposition of function declaration using a mix of javascript and php language.
<script>
//some JS code
<?php getVideos() ?>
//some JS code
</script>
<?php function getVideos()
{
//some code
}
?>
The problem is that the function is declared in another part of the html code, and the page won't work until i don't move it before the JS code. There is a solution without need to move the php code?
EDIT: i wanna precise that my html file is with a php extension (index.php) and i can access to php variables along the entire document normally