wp_doing_ajax()

Determines whether the current request is a WordPress Ajax request.