Best approach to inject variable data into JavaScript files?
Drupal have a javascript array for save settings and variables, take a look here:

http://api.drupal.org/api/drupal/includes--common.inc/function/drupal_add_js/6

Check the "settings" option in that page.

A example could be:

$my_module_variables = array(
  "url"  =&gt; "http://google.com",
  "name" =&gt; "this is a variable"
);

drupal_add_js(array("my_module_vars" =&gt; $my_module_variables),'settings');


And for use it in your javascript files you can do:

console.log(drupal.settings.my_module_vars.url);
//will print http://google.com
console.log(drupal.settings.my_module_vars.name);
//will print "this is a variable"


In this way you can set javascript vars without need print javascript code, only using a php array.