Send same name multiple checkbox values via ajax
PHP Snippet 1:
var checked = [];
$("input[name='userpages[]']:checked").each(function ()
{
checked.push(parseInt($(this).val()));
});
PHP Snippet 2:
var data = []
$('input[name="userpages[]"').each (function (index, element) {
data[$(element).attr('id')] = $(element).val();
});
console.log(data);