so in my THEME_preprocess_page I have
drupal_add_js(array('variableName' => 'value'), 'setting');
and in my js file
alert(Drupal.settings.variableName);
I get 'undefined' is it possible to pass a variable to javascript in this way?
try the following
$(function() {
alert(Drupal.settings.variableName);
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.