Pass checkbox values to php script page jquery
<p>I have a following code it is getting the values of checked checkboxes and submit the data on button click.Pls look into the code and do let me where i am wrong.It is not working</p>

<pre><code>$(document).ready(function() {
$(function(){
  $('#btnClick').click(function(){
    var val = [];
    $(':checkbox:checked').each(function(i){
      val[i] = $(this).val();
      $.ajax({
            url: 'server.php',
            type: "POST",
           data: ({val[i]}), ????
           success: function(data){

            }
        });


    });
  });
});
});
</code></pre>
