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');
Result: "Before" was alerted then returned to Basic page, no orderid. What have I done wrong?