I have been reading how to pass variables from a php webpage to a separate javascript file, but am not having any luck.

Please don't mark this as duplicate, as I know there are a ton of things out there telling the ways to do this. I recognize those posts and am more just checking my syntax or seeing if there is anything unique about my specific situation that is causing those methods not to work. 

So I have a PHP webpage where I POSTed some variables to:

```
DOCTYPE HTML

...

 <?php
            $id = $_POST["id"];
            $name = $_POST["name"];
    ?>
...

HTML code with some usage of PHP variables

javascriptFunction()

end page

```

Then in a separate javascript file I have:

```
var markerlocation = '<?php echo $point; ?>'; 

function javascriptFunction () {

alert("markerlocation");

});

```

This seems really straight forward, but for whatever reason I can't get it. I also have tried with json encode. 

I can delete this when done.
Sincere thanks for any help.