function ajax_command_data

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 modules/simpletest/tests/ajax_forms_test.module
Ajax callback for 'data'.
ajax_forms_test_simple_form_checkbox_callback in modules/simpletest/tests/ajax_forms_test.module
Ajax callback triggered by checkbox.
ajax_forms_test_simple_form_select_callback in modules/simpletest/tests/ajax_forms_test.module
Ajax callback triggered by select.

File

includes/ajax.inc, line 1212

Code

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.