This question already has an answer here:
Can somebody help me with this problem. In the body of a Basic page:
drupal_add_js(array('my_var' => array('orderid' => '123')), 'setting');
drupal_add_js('sites/all/scripts/printout.js');
In printout.js:
alert("Before");
alert(Drupal.settings.my_var.orderid);
Result: "Before" was alerted then returned to Basic page, no orderid. What have I done wrong?