title: Checkbox (iswitch) in html table with multiple rows
body: <p>This is the HTML code (a part of the table code):</p>
  
  <pre><code>&lt;td class="center"&gt;
      &lt;?php if ($row['datum_afhaling']) { ?&gt;
              &lt;input class="active iswitch iswitch-success" type="checkbox" cdid="&lt;?php echo $row['cdid']; ?&gt;" value="&lt;?php echo $row['id']; ?&gt;" checked&gt;&lt;/td&gt;
          &lt;?php } else { ?&gt;
              &lt;input class="active iswitch iswitch-success" type="checkbox" cdid="&lt;?php echo $row['cdid']; ?&gt;" value="&lt;?php echo $row['id']; ?&gt;"&gt;&lt;/td&gt;
      &lt;?php } ?&gt;
  &lt;/td&gt;
  </code></pre>
  
  <p>And the javascript code:</p>
  
  <pre><code>$("input.active").click(function() {
  
      var check_active = $(this).is(':checked') ? 'ja' : 'nee';
      var check_id = $(this).attr('value');
      var cd_id = $(this).attr('cdid');
  
      $.ajax({
          type: "POST",
          url: "cudi-afhalen-status-ajax.php",
          data: {id: check_id, active: check_active, cdid: cd_id},
          success: function(){
  
              alert ('id: '+check_id+' &amp; active: '+check_active+' &amp; cdid: '+cd_id);
              location.href='cudi-bestellingen-overzicht.php';
          }
      });
      return true;
  });
  </code></pre>
  
  <p>If I switch the checkbox to the other side I create a alertbox with some params. That works great so far, but the code gives me 15 alertboxen after each other because I have 15 rows in my table. The values (params) in all alertboxes are the same. I switch 1 checkbox-iswitch so I will have just 1 alertbox with the params and not all 14 other boxes. I don't know why it is happen?</p>
  
  <p><strong>EDIT</strong>
  I found what is going wrong with the code here. The javascript code was inside my while loop. So i replaced it outside my loop and everything goes fine.</p>