Use drupal.settings variables on javascript
It gets its value from your PHP code. Here is an example of using drupal_add_js:

//Your module.php
$settings = array(
  'helloWorld' =&gt; array(
    'display' =&gt; 'alert',
    'message' =&gt; 'Hello World!',
  ),
);
drupal_add_js($settings, 'setting');


You can access the message in your JavaScript with Drupal.settings.helloWorld.message.