Instead, display the automatic membership user count details in a bootbox alert.
data.automatic_membership_email_domains = email_domains;
data.id = group_id;
I don’t like how domains is inserted here as it looks like an opportunity for SQL injection. Can you change it to be parameter instead?
(I realize the old code did this too, but this is an opportunity to harden our app.)
Looks like you left in debugging by accident
Looks good now! Thanks.