In my module I have the following code.
$my_settings = array( 'basePath' => '/', 'my_locs' => $my_locs // Array of numbers ); drupal_add_js(array('my_module' => $my_settings), 'setting');
var my_locs = Drupal.settings.my_module.my_locs;
From Goggle Chrome console, I get the following error.
Uncaught TypeError: Cannot read property 'my_locs' of undefined google_elev.js
These are the various output I obtain from the console.
>Drupal.settings.my_module.my_locs [41, 9, 42, 9]
>my_locs = 2 2
>var my_locs undefined
>my_locs = Drupal.settings.my_module.my_locs [41, 9, 42, 9]
>my_locs [41, 9, 42, 9]
I don't know what to try. I don't understand if it is a syntax problem, if I must define the var to be an array before, or if something tricky in the order of callings have to be accomplished.