function ajax_command_data

7.x ajax.inc ajax_command_data($selector, $name, $value)

Creates a Drupal Ajax 'data' command.

The 'data' command instructs the client to attach the name=value pair of data to the selector via jQuery's data cache.

This command is implemented by Drupal.ajax.prototype.commands.data() defined in misc/ajax.js.

Parameters

$selector: A jQuery selector string. If the command is a response to a request from an #ajax form element then this value can be NULL.

$name: The name or key (in the key value pair) of the data attached to this selector.

$value: The value of the data. Not just limited to strings can be any format.

Return value

An array suitable for use with the ajax_render() function.

See also

http://docs.jquery.com/Core/data#namevalue

Related topics

3 calls to ajax_command_data()
ajax_forms_test_advanced_commands_data_callback in drupal-7.x/modules/simpletest/tests/ajax_forms_test.module
Ajax callback for 'data'.
ajax_forms_test_simple_form_checkbox_callback in drupal-7.x/modules/simpletest/tests/ajax_forms_test.module
Ajax callback triggered by checkbox.
ajax_forms_test_simple_form_select_callback in drupal-7.x/modules/simpletest/tests/ajax_forms_test.module
Ajax callback triggered by select.

File

drupal-7.x/includes/ajax.inc, line 1152
Functions for use with Drupal's Ajax framework.

Code

function ajax_command_data($selector, $name, $value) {
  return array(
    'command' => 'data',
    'selector' => $selector,
    'name' => $name,
    'value' => $value,
  );
}