function ajax_command_insert

Creates a Drupal Ajax 'insert' command using the method in #ajax['method'].

This command instructs the client to insert the given HTML using whichever jQuery DOM manipulation method has been specified in the #ajax['method'] variable of the element that triggered the request.

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 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.

Related topics

2 calls to ajax_command_insert()
ajax_forms_test_advanced_commands_insert_callback in drupal/core/modules/system/tests/modules/ajax_forms_test/ajax_forms_test.module
Ajax form callback: Selects 'insert'.
ajax_prepare_response in drupal/core/includes/ajax.inc
Converts the return value of a page callback into an Ajax commands array.

File

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

Code

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