jquery checkboxes, how to get all selected checkboxes and add them to array?
<p>Hi I have the following page:</p>

<pre><code>&lt;input type="checkbox"  name="fruit1" id="1"  class="box"&gt;Banana&lt;br /&gt;&lt;br /&gt;
&lt;input type="checkbox"  name="fruit2" id="2"  class="box"&gt;Cherry&lt;br /&gt;&lt;br /&gt;
&lt;input type="checkbox"  name="fruit3" id="3"  class="box"&gt;Strawberry&lt;br /&gt;&lt;br /&gt;
&lt;input type="checkbox"  name="fruit4" id="4"  class="box"&gt;Orange&lt;br /&gt;&lt;br /&gt;
&lt;input type="checkbox"  name="fruit5" id="5"  class="box"&gt;Peach&lt;br /&gt;&lt;br /&gt;
&lt;input type="button" id="groupdelete" value="clickme"&gt;&lt;br /&gt;
</code></pre>

<p>
 </p>

<pre><code> $(document).ready(function(){

$('#groupdelete').on('click', function(){
  var names = [];
   $('input:checked').each(function() {

       names.push($('input:checked').attr("name") + $('input:checked').attr('id'));

 });
   console.log(names); 
})

})
</code></pre>

<p></p>

<p>What I am trying to do is the following:</p>

<p>To add the checked checkboxes in the array. And after that, I would like to be able to pass the value in php variable.</p>

<p>When I excecute the code now, I am getting result like this:</p>

<p>["fruit22", "fruit22", "fruit22"]</p>

<p>Any help will be deeply appreciated.</p>

<p>Regards, Zoreli</p>
