Apologies if title is not appropriate. I want to get rate of specific product using jQuery and show on their specific text field of rate. The problem is I can not show the specific rate of that product on its text of that row.
In my case I'm getting the rate of each product but unable to display it on particular text field of that row. There is nothing problem in my controller, model or the variable window.PId. I'm getting the rate of each product, I've problem in just displaying it on particular row.
Kindly don't discourage if anything is wrong with question
$(document).on('focusout','input[id^=ProductId]',function(){
var PId2 = window.PId;
var counter = 1;
$.ajax({
url: '<?php echo base_url(); ?>Purchase/GetProductRate',
data:{Product:PId2},
type: 'post',
dataType: 'html',
success:function(data){
$("#Rate_"+counter).val(data);
}
})
counter++;
})
» HTML
<?php
$SNo = 1;
for ($i=0; $i < 5; $i++) {
?>
<tr class="txtMult">
<td style='padding:5px; width:2%;'><?php echo $SNo; ?></td>
<td style='padding:5px; width:10%; text-align:left;'>
<input type="text" class="form-control" name="ProductId[]" id="ProductId_<?php echo $SNo; ?>" autocomplete="off">
<input type='hidden' name="hdnProductId[]" id='hdnProductId_<?php echo $SNo; ?>'>
</td>
<td style='padding:5px; width:5%;'><input type='number' step="0.01" style='width:100%;text-align:right;' name='Quantity[]' class='Quantity' id='Quantity_<?php echo $SNo; ?>' value='<?php echo $Ordervalue["Quantity"]; ?>' autocomplete='off'></td>
<td style='padding:5px; width:8%;'><input type="number" step="0.01" style="width:100%; text-align:left;" id="DeductionRawMaterial_<?php echo $SNo; ?>" name="DeductionRawMaterial[]" autocomplete="off" required="required"></td>
<td style='padding:5px; width:5%;'><input type="number" step="0.01" style="width:100%; text-align:right;" name="Rate[]" class="Rate" id="Rate_<?php echo $SNo; ?>" autocomplete='off'></td>
<td style='padding:5px; width:5%;'><input type="number" style="width:100%; text-align:right;" name="Amount[]" class="Amount" id="Amount_<?php echo $SNo; ?>" readonly="readonly"></td>
<td style='padding:5px; width:5%;'><input type="number" style="width:100%; text-align:right;" name="GST[]" class="GST" id="GST_<?php echo $SNo; ?>" autocomplete="off"></td>
<td style='padding:5px; width:5%;'><input type="number" style="width:100%; text-align:right;" name="GSTAmount[]" class="GSTAmount" id="GSTAmount_<?php echo $SNo; ?>" readonly="readonly"></td>
<td style='padding:5px; width:5%;'><input type="number" style="width:100%; text-align:right;" name="FED[]" class="FED" id="FED_<?php echo $SNo; ?>" autocomplete="off"></td>
<td style='padding:5px; width:5%;'><input type="number" style="width:100%; text-align:right;" name="FEDAmount[]" class="FEDAmount" id="FEDAmount_<?php echo $SNo; ?>" readonly="readonly"></td>
<td style='padding:5px; width:7%;'><input type="number" min="0" style="width:100%; text-align:right;" name="NetAmount[]" class="NetAmount" id="NetAmount_<?php echo $SNo; ?>" readonly="readonly"></td>
<td style="padding:5px; width:2%;">
<span style='color:red;' id='remove_".$SNo."' class='fa fa-times-circle'></span>
</td>
</tr>
<?php $SNo++; } ?>
» This is what result comes
» This is what i want to get
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.