将配置选项从文件传递到javascript

In my PHP project, there is a javascript code that is supposed to use some values defined in a config file. So, I'm looking for best way to to pass config values to javascript, without mixing php and js. I was thinking that this might be accomplished with Node.js, where config file would be read and parsed, and then this Node module would be converted into browser JS with browserify. Is this even possible ?

If you don't want to mix PHP code with JS code you can run ajax call in javascript to a php function that returns JSON with data you need.

End of function in PHP would be something like:

exit(json_encode($data));

and in javascript (with jquery):

$.post("script.php", {}, function(data) {
    var configParams = JSON.parse(data);
});