Example: AJAX

Same name in other branches
  1. 7.x-1.x ajax_example/ajax_example.module \ajax_example
  2. 4.0.x modules/ajax_example/ajax_example.module \ajax_example

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.

Parent topics

File

modules/ajax_example/ajax_example.module, line 8

Functions

Title Sort descending File name Summary
AjaxExampleController::renderLinkRenderableArray modules/ajax_example/src/Controller/AjaxExampleController.php Demonstrates a clickable AJAX-enabled link using the 'use-ajax' class.

Classes

Title Sort descending File name Summary
AjaxExampleMenuTest modules/ajax_example/tests/src/Functional/AjaxExampleMenuTest.php Verify tool block menu items and operability of all our routes.
Autotextfields modules/ajax_example/src/Form/Autotextfields.php Show textfields based on AJAX-enabled checkbox clicks.
DependentDropdownTest modules/ajax_example/tests/src/Functional/DependentDropdownTest.php Functional test of non-AJAX dependent dropdown example.
DynamicFormSectionsTest modules/ajax_example/tests/src/Functional/DynamicFormSectionsTest.php Functional test of non-AJAX dependent dropdown example.
EntityAutocomplete modules/ajax_example/src/Form/EntityAutocomplete.php A simple autocomplete form which looks up usernames.