Integration between js and php code in custom module I'm writing a custom module which outputs blocks with various deltas. Later, a jQuery code has to be attached for every generated block, aware of their id's, as in $('#mymodule-block-delta'). How is that accomplished?
You would use drupal_add_js() to pass the data from PHP to JS:

$block_ids = array('blockid1', 'blockid2');
$settings = array('myModule' =&gt; array('blockIds' =&gt; $block_ids));
drupal_add_js($settings, 'setting');


Then in JS you can pick these up like so:

var blockIds = Drupal.settings.myModule.blockIds;