On the front end with drupal.settings you can make variables from PHP available to Javascript
e.g<?php
drupal_add_js(array('myModule' => array('key' => 'value')), 'setting');
?>
In Javascript it will be available as:
<script>
if (Drupal.settings.myModule.key == value){
alert('Got it!');
}
</script>


Reply With Quote
