Sign up ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I use this but cannot find solution.

drupal_add_js(
  array('YOURMODULE' => array(
    'testvar' => $testvar
  )),
  array('type' => 'setting')
);
share|improve this question

marked as duplicate by Mołot, Anil Sagar, Letharion, Елин Й., Bala Oct 2 '14 at 2:56

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer 1

Check the object Drupal.settings using Firebug.

Or insert the code into your a js file.

Drupal.behaviors.YOURMODULE = function (context) {
  alert(Drupal.settings.YOUMODULE.testvar);
}
share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.