gpt4 book ai didi

javascript - 如何使用codeigniter从动态创建的表中的数据库中获取数据

转载 作者:行者123 更新时间:2023-11-30 20:06:41 25 4
gpt4 key购买 nike

<table class="table table-bordered table-striped table-xxs" id="tb3" name="tb3">
<thead>
<tr>
<th><a href="javascript:void(0);" id="multi" name="multiplerows" title="Add More Person"></a></th>
<th>Product Code</th>
<th>Product Name</th>
<th>Qty</th>
<th>Rate</th>
<th>Amount</th>


</tr>
</thead>
<tbody>
<tr >
<td><a href='javascript:void(0);' class='remove3'><span class='glyphicon glyphicon-remove'></span></a></td>

<td>

<input style="width:80px" type="text" id="Product_Code" class="form-control input-xs Product_Code " onkeyup="fetch()" value="<?php echo $r->Product_Code; ?>" name="Product_Code[]" required></td>

<td ><input style="width:300px" type="text" id="Product_Name" class="form-control input-xs" value="<?php echo $r->Prdtname; ?>" name = "Prdtname[]" value=""> </td>


<td><input style="width:80px" type="text" id="Qty" class="form-control input-xs" value="<?php echo $r->Qty; ?>" name="Qty[]" required></td>

<td><input style="width:100px" type="text" id="Rate" class="form-control input-xs" value="<?php echo $r->rate; ?>" name="rate[]" required></td>

<td><input style="width:150px" type="text" id="Value" class="form-control input-xs" value="<?php echo $r->amount; ?>" name="amount[]" ></td>


<th><a href="javascript:void(0);" id="addMore3" name= addmore title="Add More Person"><span class="glyphicon glyphicon-plus"></span></a></th>

</tr>
</tbody>
</table>

这个表格代码....

<script>
$(document).ready(function (){
$('#addMore3').on('click', function() {

var data = $("#tb3 tr:eq(1)").clone(true).appendTo("#tb3");
data.find("input").val('');

});
$(document).on('click', '.remove3', function() {
var trIndex = $(this).closest("tr").index();
if(trIndex>0) {
$(this).closest("tr").remove();
} else {
alert("Sorry!! Can't remove first row!");
}
});

});

</script>

这是通过单击“+”事件创建表格的 javascript 代码。

我的 prblm 是如何从这个自动表中的数据库显示中获取数据..

最佳答案

您应该能够使用 ajax 调用来执行此操作。

当你使用 codeigniter -

查看: 编写您的 ajax 和表格生成代码。Controller:获取ajax请求并将其传递给modal。Modal:从数据库中获取数据。

您应该返回要查看的对象数组,然后只解析数据并生成表格。如果你不想写表格代码和ajax那么你可以使用数据表插件

关于javascript - 如何使用codeigniter从动态创建的表中的数据库中获取数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52847550/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com