Question: I'm working in a framework where not all the pages are the same relative path from the asset directories, so they often use a WWW variable to get the correct path to css, php, js files etc.

I'm setting up a form that submits via ajax, and for the `url` path to work, it will have to be an absolute path, but based on a variable ideally for maintainability.

Since that WWW variable is already set up in the php, I was thinking about including a php page with `<script>` tags and that way I can use the same variable..

Is that considered really kludgy? or is there another way to do it? Ideally I want to have all the config just in one file to make it more easily portability, which is why I don't just have a js file with the path. So if there's some way to autogenerate it or something...

Answer: 
I usually just render that kind of stuff on page instead of incurring a separate request just to get a variable.

For example:

```
<script type="text/javascript">var www_var = '<?php echo $www_var; ?>'</script>

```
I assume there's some complication in using a base-url relative path like `/path/to/foo/`? I personally don't like to mix programming languages like this. In other words, I consider it not to be proper to do this.