title: Submit form via AJAX with incrementing checkbox id's
body: <p>I have an AJAX form submission working properly but I have incrementing id's to my checkboxes that I need to be submitted according to what check boxes are checked, then when the user submits the checked selections the data pass over to my PHP script.</p>
  
  <p>How do I pass all checked checkboxes over to my PHP script via AJAX?</p>
  
  <pre><code>$(function () {
      $(".submit").click(function () {
          var pageReturn = $("#pageReturn").val();
          var sendCheck = $("#sendCheck").val();
          var dataString = 'pageReturn=' + pageReturn + '&amp;sendCheck=' + sendCheck;
  
          if (emailLink == '' || pageReturn == '' || sendCheck == '') {
              $('.success').fadeOut(200).hide();
              $('.error').fadeOut(200).show();
          } else {
              $.ajax({
                  type: "POST",
                  url: "phpscripts/compose.php?artid=&lt;?php echo $artid; ?&gt;&amp;userart=&lt;?php echo $_GET['userart'];?&gt;",
                  data: dataString,
                  cache: false,
                  success: function () {
                      $('.success').fadeIn(200).show();
                      $('.error').fadeOut(200).hide();
                  }
              });
          }
          return false;
      });
  });
  </code></pre>
  
  <p>To pass all check boxes would I add +1 to where my checkboxes are being passed like:</p>
  
  <pre><code>var sendCheck = $("#sendCheck").val()+1;
  </code></pre>
  
  <p>My HTML code for my check boxes looks like this</p>
  
  <pre><code>&lt;input name="sendCheck" id="sendCheck&lt;?php echo $i++; ?&gt;" class="reccomendCheck" type="checkbox" value="&lt;?php echo $row_ArtContact['contact_id'];?&gt;" /&gt; 
  </code></pre>
  
  <p>Check boxes with incrementing values that need to be passes over to my PHP script.</p>
  
  <p>In theory there could be an unlimited number of checkboxes that the user could randomly check and need to be summited.</p>