Integration between js and php code in custom module
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;