Cleanup alert and ajax logic.