title: jquery function is sending alert as per the total no of records in mysql table
body: <p>I have several records to be retrieved from mysql table and each of the record will have delete button, for deletion im using the script below #1 or #2.</p>
  
  <p>when im using #1 it gives alert 1 time when i click on delete button to delete any record, but when i use #2 it gives me alert 5 times if i have 5 record or gives alert as per the total number of records in the mysql table can anybody please fix the #2 becuase it is fulfilling my needs as i want.</p>
  
  <p><strong>HTML/PHP Part</strong></p>
  
  <pre><code>&lt;?php
  include('inc/db.php');
  $rest_menuC = mysql_query("select * from menu_items where status = 1");
  while ($mitemC  = mysql_fetch_array($rest_menuC)){
      $mitem_idC  = $mitemC['id'];
      $mitem_enC  = $mitemC['ename'];
      $mitem_anC  = $mitemC['aname'];
      $mitem_fnC  = $mitemC['filename'];
      $mitem_ssC  = $mitemC['status'];
  $order_temp =   mysql_query("select * from temp_cart where item_id = '".$mitem_idC."'  and ses_mem=113 order by id");
  while ($torder = mysql_fetch_assoc($order_temp)) {
      $prITTD     =   $torder['id'];
      $prITTC     =   $torder['item_id'];
      $prIDTC     =   $torder['price_id'];
      $qtyT       =   $torder['qty'];     
      $pc1        =   $torder['pc1'];
      $pc2        =   $torder['pc2'];
      $pc3        =   $torder['pc3'];
      $pc4        =   $torder['pc4'];
      $pc5        =   $torder['pc5'];
      $pc6        =   $torder['pc6'];
      $pc7        =   $torder['pc7'];
      $pc8        =   $torder['pc8'];
      $pc9        =   $torder['pc9'];
      $pc10       =   $torder['pc10'];
      $pc11       =   $torder['pc11'];
      $pc12       =   $torder['pc12'];
  ?&gt;
      &lt;li&gt;
          &lt;div class="product-thumb"&gt;
          &lt;img style="width:40px; height:40px;" src="images/rest_menu_items/&lt;?php echo $mitem_fnC; ?&gt;" alt=""&gt;
          &lt;/div&gt;
          &lt;div class="product-name"&gt;
              &lt;a href="#"&gt;&lt;?php echo $mitem_enC; ?&gt;&lt;/a&gt;
          &lt;/div&gt;
          &lt;div class="qty-wrap"&gt;
              &lt;span class="product-quantity"&gt;
                  &lt;span class="quantity"&gt;Qty. &lt;?php echo $qtyT; ?&gt;&lt;/span&gt; Price.
              &lt;/span&gt;
              &lt;span class="amount"&gt;&lt;?php echo $prIDTC; ?&gt;&lt;/span&gt;
  &lt;?php
      echo "&lt;br&gt;&lt;br&gt;";
  ?&gt;
  &lt;?php
  $order_tempCHP      =   mysql_query("select * from choice_price
  WHERE
   id IN('$pc1','$pc2','$pc3','$pc4','$pc5','$pc6','$pc7','$pc8','$pc9','$pc10','$pc11','$pc12') !=0
  AND item_id = '".$prITTC."'");
  $toarder = mysql_num_rows($order_tempCHP);
  while ($torderCP    = mysql_fetch_assoc($order_tempCHP)) {
      $CPid   =   $torderCP['id'];
      $CPenm  =   $torderCP['ename'];
      $CPicd  =   $torderCP['choice_id'];
      $CPitd  =   $torderCP['item_id'];
      $CPlpr  =   $torderCP['price'];
  
  //if ($pc1 &gt; 0.000 || $pc2 &gt; 0.000 || $pc3 &gt; 0.000 || $pc4 &gt; 0.000 || $pc5 &gt; 0.000 || $pc6 &gt; 0.000 || $pc7 &gt; 0.000 || $pc8 &gt; 0.000 || 
  //$pc9 &gt; 0.000 || $pc10 &gt; 0.000 || $pc11 &gt; 0.000 || $pc12 &gt; 0.000){
  $order_tempCHPa     =   mysql_query("select * from choice_price
  WHERE
   id = '$pc2'
  AND id != 0
  AND item_id = '".$prITTC."'");
  $toardera = mysql_num_rows($order_tempCHPa);
  if ($toarder == 1){
  ?&gt;
  &lt;div id="record-&lt;?php echo $prITTC; ?&gt;"&gt;
  &lt;span class="quantity"&gt;&lt;font color="red" style="font-weight:bold;"&gt;Choices # &lt;?php echo $CPicd; ?&gt;&lt;/font&gt;&lt;/span&gt;&lt;br&gt;
  &lt;span class="quantity"&gt; &lt;?php echo $CPenm; ?&gt; # &lt;?php echo $CPlpr; ?&gt;&lt;/span&gt;
  &lt;!--&lt;a href="#" onclick="ConfirmChoice(); return false;"&gt;X&lt;/a&gt;--&gt;
  &lt;a href="?delete=&lt;?php echo $prITTC; ?&gt;" class="deleteAS"&gt;X&lt;/a&gt;
  &lt;/div&gt;
  &lt;?php }else{ ?&gt;
  &lt;div id="record-&lt;?php echo $prITTC; ?&gt;"&gt;
  &lt;span class="quantity"&gt;&lt;font color="red" style="font-weight:bold;"&gt;Choices # &lt;?php echo $CPicd; ?&gt;&lt;/font&gt;&lt;/span&gt;&lt;br&gt;
  &lt;span class="quantity"&gt; &lt;?php echo $CPenm; ?&gt; # &lt;?php echo $CPlpr; ?&gt;&lt;/span&gt;
  &lt;!--&lt;a href="#" onclick="ConfirmChoice(); return false;"&gt;X&lt;/a&gt;--&gt;
  &lt;a href="?delete=&lt;?php echo $prITTC; ?&gt;" class="deleteAS"&gt;X&lt;/a&gt;
  &lt;/div&gt;
  &lt;?php } } ?&gt;
     &lt;/li&gt;
  </code></pre>
  
  <p><strong>menu_cart_delete_item_choice.php</strong></p>
  
  <pre><code>$idA    = mysql_real_escape_string($_GET['ajax']);
  $iidA   = mysql_real_escape_string($_GET['delete']);
  $delete = mysql_query("
  UPDATE
      temp_cart
  SET
      pc1 = 0
  WHERE
      item_id = '".$iidA."'
  AND
      id = '".$idA."'
  AND
      ses_mem= 113
  ");
  </code></pre>
  
  <p><strong>#1</strong></p>
  
  <pre><code>function ConfirmChoice() {
  var confirmText = "Are you sure you want to delete this object?";
      if(confirm(confirmText)) {
          $.ajax({
              type:"POST",
              url:"menu_cart_delete_item_choice.php?idSa=&lt;?php echo $prITTD; ?&gt;&amp;iida=&lt;?php echo $mitem_idC; ?&gt;",
              success:function () {
              // Here goes something...
              },
          });
      }
  }
  </code></pre>
  
  <p><strong>#2</strong></p>
  
  <pre><code>$(document).ready(function() {
      $('a.deleteAS').click(function(e) {
          e.preventDefault();
          var parent = $(this).parent();
          var confirmText = "Are you sure you want to delete this object?";
          if(confirm(confirmText)) {
          $.ajax({
              type: 'get',
              url: 'menu_cart_delete_item_choice.php',
              data: 'ajax=&lt;?php echo $prITTD; ?&gt;&amp;delete=' + parent.attr('id').replace('record-',''),
              beforeSend: function() {
                  parent.animate({'backgroundColor':'#fb6c6c'},100);
              },
              success: function() {
                  parent.slideUp(100,function() {
                      parent.remove();
                  });
              }
          });
      }
      });
  });
  </code></pre>