function ajax_command_html

Creates a Drupal Ajax 'insert/html' command.

The 'insert/html' command instructs the client to use jQuery's html() method to set the HTML content of each element matched by the given selector while leaving the outer tags intact.

This command is implemented by Drupal.ajax.prototype.commands.insert() 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.

$html: The data to use with the jQuery html() method.

$settings: An optional array of settings that will be used for this command only.

Return value

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

See also

http://docs.jquery.com/Attributes/html#val

Related topics

4 calls to ajax_command_html()
ajax_forms_test_advanced_commands_html_callback in drupal/core/modules/system/tests/modules/ajax_forms_test/ajax_forms_test.module
Ajax form callback: Selects 'html'.
Callbacks::checkboxCallback in drupal/core/modules/system/tests/modules/ajax_forms_test/lib/Drupal/ajax_forms_test/Callbacks.php
Ajax callback triggered by checkbox.
Callbacks::selectCallback in drupal/core/modules/system/tests/modules/ajax_forms_test/lib/Drupal/ajax_forms_test/Callbacks.php
Ajax callback triggered by select.
ViewEditFormController::rebuildCurrentTab in drupal/core/modules/views/views_ui/lib/Drupal/views_ui/ViewEditFormController.php
Regenerate the current tab for AJAX updates.

File

drupal/core/includes/ajax.inc, line 799
Functions for use with Drupal's Ajax framework.

Code

function ajax_command_html($selector, $html, $settings = NULL) {
  return array(
    'command' => 'insert',
    'method' => 'html',
    'selector' => $selector,
    'data' => $html,
    'settings' => $settings,
  );
}