1 ajax_example_advanced.inc ajax_example_advanced_commands_data_callback($form, $form_state)

Callback for 'data'.

See also

ajax_command_data()

File

modules/examples/ajax_example/ajax_example_advanced.inc, line 321
AJAX Commands examples.

Code

function ajax_example_advanced_commands_data_callback($form, $form_state) {
  $selector = '#data_div';
  $text = $form_state['values']['data_command_example'];
  list($key, $value) = preg_split('/=/', $text);

  $commands = array();
  $commands[] = ajax_command_data($selector, $key, $value);
  $commands[] = ajax_command_replace("#data_status", "<div id='data_status'>Updated data_command_example with key=$key, value=$value; " . date('r') . "</div>");
  return array('#type' => 'ajax', '#commands' => $commands);
}