1 ajax.inc ajax_command_data($selector, $name, $value)

Creates a Backdrop 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 Backdrop.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

File

core/includes/ajax.inc, line 1267
Functions for use with Backdrop's Ajax framework.

Code

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