Helper functions for different ajax tasks.