Use Drupal's Ajax Framework.