ajax_command_before

Versions
mediamosa-21
ajax_command_before($selector, $html, $settings = NULL)

Creates a Drupal AJAX 'insert/before' command.

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

This command is implemented by Drupal.ajax.prototype.commands.insert() defined in misc/ajax.js.

See also

http://docs.jquery.com/Manipulation/before#content

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 before() 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

Code

includes/ajax.inc, line 756

<?php
function ajax_command_before($selector, $html, $settings = NULL) {
  return array(
    'command' => 'insert',
    'method' => 'before',
    'selector' => $selector,
    'data' => $html,
    'settings' => $settings,
  );
}
?>