Ajax in Drupal

The other day needed to use AJAX to implement a feature in Drupal. The main reason to use AJAX was to be able to use caching and still have some content vary slightly on the same page. I could not find a clear answer straight away.