drupal_add_js() 'setting' not being set on form submit I have a form and on that form the #submit action it calls a function that saves some data.   Now what I need to do is  I need to pass some data back to the website confirm page to be used by JavaScript. To do this I used drupal_add_js() 'settings' but this does seem to work? The data never gets set.
From what I've read I think it might be something with the form redirecting during the submission process and the JS is getting lost?
it might be something with the form redirecting during the submission process and the JS is getting lost?


Yes, you are absolutely right! Normaly, after form submitting user is redirected with drupal_goto() function. Messages which set with drupal_set_message() are stored in $_SESSION so they are not lost, but drupal_add_js() doesn't use session.
You can prevent redirect in your submit function:  

// In this case your form hanler will be able to see flag $form_state['submitted'] and
// other data from previous form processing to indicate that form was submitted.
$form_state['rebuild'] = TRUE;
// Will work.
drupal_add_js(array('myModule' =&gt; array('test' =&gt; 'test-value')), 'setting');


Or with:  

$form_state['redirect'] = FALSE;
// Will work, too
drupal_add_js(array('myModule' =&gt; array('test' =&gt; 'test-value')), 'setting');


But I would have used $_SESSION as it is more flexible.   

$_SESSION['js_settings'] = array('myModule' =&gt; array('test' =&gt; 'test-value'), 'setting');


Then you have to process $_SESSION yourself in accordance with your site logic.