These examples show basic AJAX concepts.
General documentation is available at AJAX Framework documentation and at the AJAX Forms handbook page.
The several examples here demonstrate basic AJAX usage.
Functions & methods
| Name | Description |
|---|---|
| ajax_example_autocheckboxes | AJAX-enabled select element causes replacement of a set of checkboxes based on the selection. |
| ajax_example_autocheckboxes_callback | Callback element needs only select the portion of the form to be updated. Since #ajax['callback'] return can be HTML or a renderable array (or an array of commands), we can just return a piece of the form. See @link ajax_example_advanced.inc… |
| ajax_example_autotextfields | Show/hide textfields based on AJAX-enabled checkbox clicks. |
| ajax_example_autotextfields_callback | Selects the piece of the form we want to use as replacement text and returns it as a form (renderable array). |
| ajax_example_dependent_dropdown | A form with a dropdown whose options are dependent on a choice made in a previous dropdown. |
| ajax_example_dependent_dropdown_callback | Selects just the second dropdown to be returned for re-rendering |
| ajax_example_intro | |
| ajax_example_menu | Implements hook_menu(). |
| ajax_example_render_link | Demonstrates a clickable AJAX-enabled link using the 'use-ajax' class. |
| ajax_example_simplest | Simple form whose ajax-enabled 'changethis' member causes a text change in the description of the 'replace_textfield' member. See Form API Tutorial |
| ajax_example_simplest_callback | Callback for ajax_example_simplest. |
| ajax_example_submit_driven_ajax | A very basic form which with an AJAX-enabled submit. |
| ajax_example_submit_driven_callback | Select the 'box' element, change the markup in it, and return it as a renderable array. |
| ajax_link_response | Callback for link example. |
| _ajax_example_get_first_dropdown_options | Helper function to populate the first dropdown. This would normally be pulling data from the database. |
| _ajax_example_get_second_dropdown_options | Helper function to populate the second dropdown. This would normally be pulling data from the database. |
File
- ajax_example/
ajax_example.module, line 8 - AJAX Examples module file with basic examples.