How to send variable to the javascript in Drupal?
The standard way to do this in Drupal is with drupal_add_js(), using the "setting" type, e.g.:

drupal_add_js(array('variableName' =&gt; 'value'), 'setting');


That will make the variable available on the JS side at Drupal.settings.variableName.