ajax_test_render

Versions
7
ajax_test_render()

Menu callback; Copies $_GET['commands'] into $commands and ajax_render()s that.

Additionally ensures that ajax_render() incorporates JavaScript settings by invoking drupal_add_js() with a dummy setting.

Code

modules/simpletest/tests/ajax_test.module, line 33

<?php
function ajax_test_render() {
  // Prepare AJAX commands.
  $commands = array();
  if (!empty($_GET['commands'])) {
    $commands = $_GET['commands'];
  }
  // Add a dummy JS setting.
  drupal_add_js(array('ajax' => 'test'), 'setting');

  // Output AJAX commands and end the request.
  ajax_render($commands);
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.