function ajax_command_invoke

ajax_command_invoke($selector, $method, array $arguments = array())

Creates a Drupal Ajax 'invoke' command.

The 'invoke' command will instruct the client to invoke the given jQuery method with the supplied arguments on the elements matched by the given selector. Intended for simple jQuery commands, such as attr(), addClass(), removeClass(), toggleClass(), etc.

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

$method: The jQuery method to invoke.

$arguments: (optional) A list of arguments to the jQuery $method, if any.

Return value

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

Related topics

File

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

Code

function ajax_command_invoke($selector, $method, array $arguments = array()) {
  return array(
    'command' => 'invoke',
    'selector' => $selector,
    'method' => $method,
    'arguments' => $arguments,
  );
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!ajax.inc/function/ajax_command_invoke/7.x