I need to have all the values of checked checkboxes sorted with commas in javascript, so I can send the to a form sending php script.
The javascript:
var services = [];
$('#field-services:checked').each(function() {
services.push($(this).val());
});
$.post(rootUrl+'/wp-admin/admin-ajax.php', { action:"two2_send_contact_form", services:services }
I have the checkboxes inside a div with the id field-services
the php that send the email
$services = $_POST["services"];
$subject = "BLAH BLAH";
$body = "Services: $services,
$message";