1 ajax.inc | ajax_command_prepend($selector, $html, $settings = NULL) |
Creates a Backdrop Ajax 'insert/prepend' command.
The 'insert/prepend' command instructs the client to use jQuery's prepend() method to prepend the given HTML content to the inside each element matched by the given selector.
This command is implemented by Backdrop.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 prepend() 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/prepend#content
Related topics
File
- core/
includes/ ajax.inc, line 1029 - Functions for use with Backdrop's Ajax framework.
Code
function ajax_command_prepend($selector, $html, $settings = NULL) {
return array(
'command' => 'insert',
'method' => 'prepend',
'selector' => $selector,
'data' => $html,
'settings' => $settings,
);
}