I'm trying to pass variable to my js file. The file is located in my theme /js directory. The filename is backgroundConfig and this is the content of file:
(function($, Drupal){
Drupal.behaviors.backgroundAnimation = {
attach: function(context, settings) {
alert(Drupal.settings.variableName);
alert(Drupal.settings.basePath);
}
};
})(jQuery, Drupal);
So the basePath is displayed correctly, but I've no idea how to pass this variableName from template.php. I've tried couple of methods but none of them work.
There are tons of examples on the web but none of them contains the file name and the settings togather. Like this one:
drupal_add_js(array('variableName' => 'value'), 'setting');
Alright, but where I should put my filename? I always add my js file like this:
drupal_add_js(path_to_theme().'/js/backgroundConfig.js');
How to combine it togather? Detailed explanation would be useful, because there's no good example, at least I haven't found any. :(