AJAX forms in Drupal are provided by the Form API.
- You write the form using the Drupal Form API.
- You specify what element activates the AJAX behavior.
- You specify what part of the form's HTML is to be replaced by the callback.
- You write a callback that selects and returns the piece of the form which gets replaced.
- Drupal manages everything so that when the button or control is used, the callback gets called and the replacement of HTML is done.