Drupal Answers is a question and answer site for Drupal developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to change a global setting for Drupal's js. I have this on my callback:

$setting['stopWatch']['startTime'] = 4000;
ajax_command_settings($setting, TRUE),

I was wondering how I would reattach this behavior after the ajax call is finished. I have this for my js:

Drupal.behaviors.stopWatch = {
  attach: function (context, settings) {
    $('#stopwatch').stopwatch({startTime: settings.stopWatch.startTime}).stopwatch('start');

Also, I'm not sure why startTime isn't available in settings on Drupal.behaviors.stopWatch when I do ajax_command_settings($setting); instead.

share|improve this question
Are you sure the settings function is working properly? I've been trying to use it and it's not been working as advertised for me. – Paul Sheldrake Jun 6 '12 at 8:25

This will not add variables to settings. Function ajax_command_settings() just creates ajax command, that could be added to commands array. If you want to update settings after view ajax completed you should use something like this:

 * Implements hook_views_ajax_data_alter().
function module_name_tricks_views_ajax_data_alter(&$commands, $view) {
  if ($view->name == 'your_view_name') {
    $setting = module_name_get_settings($view);
    $commands[] = ajax_command_settings($setting, TRUE);
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.