title: how to get result in iteration ids in ajax call
body: <p>how to get result in iteration ids in ajax call ...the result should be in iteration ids but...the result doesnt display.how to get dsplay results in php ajax call in for loop iteration ids?.</p>
  
  <p>here is my html code</p>
  
  <pre><code>&lt;tr&gt;
                        &lt;td&gt;&lt;span id="sr_no"&gt;1&lt;/span&gt;&lt;/td&gt;
                        &lt;td&gt;&lt;select type="text" name="item_name[]" id="item_name1" class="form-control input-sm"  onChange="getbrand(this.value);" /&gt;
                        &lt;option value=""&gt;&lt;/option&gt;
                        &lt;?php
      include "conn.php";
      $sql = "SELECT category FROM `product` GROUP BY category";
      $run = mysqli_query($conn,$sql);
  
      while($row=mysqli_fetch_array($run))
      {
      ?&gt;
  &lt;option&gt;&lt;?php echo $row['category']; ?&gt;&lt;/option&gt;
          &lt;?php } ?&gt;
                        &lt;/select&gt;
                        &lt;/td&gt;
                        &lt;td&gt;
                          &lt;select type="text" name="item_name[]" id="brand" class="form-control input-sm" /&gt;
                          &lt;option value=""&gt;&lt;/option&gt;
  
                          &lt;/select&gt;
                        &lt;/td&gt;
                        &lt;td&gt;&lt;input type="text" name="order_item_quantity[]" id="order_item_quantity1" data-srno="1" class="form-control input-sm order_item_quantity" /&gt;&lt;/td&gt;
                        &lt;td&gt;&lt;input type="text" name="order_item_price[]" id="order_item_price1" data-srno="1" class="form-control input-sm number_only order_item_price" /&gt;&lt;/td&gt;
                        &lt;td&gt;&lt;input type="text" name="order_item_actual_amount[]" id="order_item_actual_amount1" data-srno="1" class="form-control input-sm order_item_actual_amount" readonly /&gt;&lt;/td&gt;
                        &lt;td&gt;&lt;input type="text" name="order_item_tax1_rate[]" id="order_item_tax1_rate1" data-srno="1" class="form-control input-sm number_only order_item_tax1_rate" /&gt;&lt;/td&gt;
                        &lt;td&gt;&lt;input type="text" name="order_item_tax1_amount[]" id="order_item_tax1_amount1" data-srno="1" readonly class="form-control input-sm order_item_tax1_amount" /&gt;&lt;/td&gt;
                       &lt;td&gt;&lt;input type="text" name="order_item_final_amount[]" id="order_item_final_amount1" data-srno="1" readonly class="form-control input-sm order_item_final_amount" /&gt;&lt;/td&gt;
                        &lt;td&gt;&lt;/td&gt;
                      &lt;/tr&gt;
                    &lt;/table&gt;
                    &lt;div align="right"&gt;
                      &lt;button type="button" name="add_row" id="add_row" class="btn btn-success btn-xs"&gt;+&lt;/button&gt;
                    &lt;/div&gt;
                  &lt;/td&gt;
                &lt;/tr&gt;
  </code></pre>
  
  <p>here is my java script</p>
  
  <pre><code>&lt;script&gt;
        $(document).ready(function(){
          var final_total_amt = $('#final_total_amt').text();
          var count = 1;
  
          $(document).on('click', '#add_row', function(){
            count++;
            $('#total_item').val(count);
            var html_code = '';
            html_code += '&lt;tr id="row_id_'+count+'"&gt;';
            html_code += '&lt;td&gt;&lt;span id="sr_no"&gt;'+count+'&lt;/span&gt;&lt;/td&gt;';
  
           html_code += '&lt;td&gt;&lt;select name="item_name[]" id="item_name'+count+'" class="form-control input-sm" onChange="getbrand(this.value);" &gt;&lt;option&gt;&lt;/option&gt;&lt;?php $sql='Select category from product GROUP BY category'; $run=mysqli_query($conn,$sql); while($row=mysqli_fetch_array($run)){ echo '&lt;option&gt;'.$row['category'].'&lt;/option&gt;'; } ?&gt;&lt;/select&gt;&lt;/td&gt;';
  
            html_code += '&lt;td&gt;&lt;select name="brand[]" id="brand'+count+'" class="form-control input-sm" &gt;&lt;option&gt;&lt;/option&gt;&lt;/select&gt;&lt;/td&gt;';
  
            html_code += '&lt;td&gt;&lt;input type="text" name="order_item_quantity[]" id="order_item_quantity'+count+'" data-srno="'+count+'" class="form-control input-sm number_only order_item_quantity" /&gt;&lt;/td&gt;';
  
            html_code += '&lt;td&gt;&lt;input type="text" name="order_item_price[]" id="order_item_price'+count+'" data-srno="'+count+'" class="form-control input-sm number_only order_item_price" /&gt;&lt;/td&gt;';
  
            html_code += '&lt;td&gt;&lt;input type="text" name="order_item_actual_amount[]" id="order_item_actual_amount'+count+'" data-srno="'+count+'" class="form-control input-sm order_item_actual_amount" readonly /&gt;&lt;/td&gt;';
  
            html_code += '&lt;td&gt;&lt;input type="text" name="order_item_tax1_rate[]" id="order_item_tax1_rate'+count+'" data-srno="'+count+'" class="form-control input-sm number_only order_item_tax1_rate" /&gt;&lt;/td&gt;';
  
            html_code += '&lt;td&gt;&lt;input type="text" name="order_item_tax1_amount[]" id="order_item_tax1_amount'+count+'" data-srno="'+count+'" readonly class="form-control input-sm order_item_tax1_amount" /&gt;&lt;/td&gt;';
  
            html_code += '&lt;td&gt;&lt;input type="text" name="order_item_final_amount[]" id="order_item_final_amount'+count+'" data-srno="'+count+'" readonly class="form-control input-sm order_item_final_amount" /&gt;&lt;/td&gt;';
  
            html_code += '&lt;td&gt;&lt;button type="button" name="remove_row" id="'+count+'" class="btn btn-danger btn-xs remove_row"&gt;X&lt;/button&gt;&lt;/td&gt;';
            html_code += '&lt;/tr&gt;';
            $('#invoice-item-table').append(html_code);
          });
  
          $(document).on('click', '.remove_row', function(){
            var row_id = $(this).attr("id");
            var total_item_amount = $('#order_item_final_amount'+row_id).val();
            var final_amount = $('#final_total_amt').text();
            var result_amount = parseFloat(final_amount) - parseFloat(total_item_amount);
            $('#final_total_amt').text(result_amount);
            $('#row_id_'+row_id).remove();
            count--;
            $('#total_item').val(count);
          });
  
  
  function getbrand(count) {
   for(k=1; k&lt;=count; k++)
            {
  $.ajax({
  type: "POST",
  url: "ajax_brand.php",
  data:'state_id='+val,
  success: function(data){ 
  
  $("#brand"+k).html(data);
  }
  });}
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>my question for this script .....how to add iteration for ids in this ajax call.</p>
  
  <pre><code>function getbrand(count) {
       for(k=1; k&lt;=count; k++)
                {
  
  
       $.ajax({
          type: "POST",
          url: "ajax_brand.php",
          data:'state_id='+val,
          success: function(data){ 
  
          $("#brand"+k).html(data);
          }
          });}
          }
  </code></pre>