function ajax_command_append

Creates a Drupal Ajax 'insert/append' command.

The 'insert/append' command instructs the client to use jQuery's append() method to append the given HTML content to the inside of each element matched by the given selector.

This command is implemented by Drupal.AjaxCommands.prototype.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 append() 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/Manipulation/append#content

Related topics

1 call to ajax_command_append()
ajax_render in drupal/core/includes/ajax.inc
Renders a commands array into JSON.

File

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

Code

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