function ajax_example_advanced_commands_data_callback in Examples for Developers 7
Callback for 'data'.
See also
1 string reference to 'ajax_example_advanced_commands_data_callback'
- ajax_example_advanced_commands in ajax_example/
ajax_example_advanced.inc - Form to display the AJAX Commands.
File
- ajax_example/
ajax_example_advanced.inc, line 319 - 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,
);
}