When you are building a custom module, sometimes you need to link drupal to a jQuery plugin.

Here is an example of using Drupal.setting together with drupal_add_js to pass information from drupal to jQuery.

For example our dummy jQuery plugin needs to be configured for :

1. width
2. height

Then we can utilize drupal_add_js to do :

// invoke hook init so the data will be passed to jQuery upon module init, You can use this method in other hook or function where you see fit to pass the information from drupal to jQuery
function my_dummy_module_init() {
$settings['any_name'] = array(
'width' => 3000,
'height' => 'any text',

// call the drupal_add_js to pass the information
drupal_add_js($settings, 'setting');

at this point when the module initializes, it will pass the "width" and "height" data to jQuery and jQuery will store the variable under Drupal.settings.any_name;

Now we need to integrate the information to our dummy jQuery plugin,
for example we are using dummy.js to hold our jQuery function

Drupal.behaviors.dummyModule = function (context)    {
// just for example sake the dummy plugin needs the var option for its configuration
var option = {
	width : Drupal.settings.any_name.width,
	height : Drupal.settings.any_name.height, 


Now your data is passed from drupal / php to jQuery successfully.