JQuery附加表单未在PHP中过帐
我试图附加包含HTML表单的表行。追加表单数据未传递给控制器。我的代码是-JQuery附加表单未在PHP中过帐,php,jquery,Php,Jquery,我试图附加包含HTML表单的表行。追加表单数据未传递给控制器。我的代码是- <form method="post" action="<?=base_url()?>controller/function_name"> <table class="table table-bordered tbsize tb_wp" id=""> <thead> <tr > <th class="firstrow">Item No.
<form method="post" action="<?=base_url()?>controller/function_name">
<table class="table table-bordered tbsize tb_wp" id="">
<thead>
<tr >
<th class="firstrow">Item No.</th>
<th class="firstrow">Part No.</th>
<th class="firstrow">Qty</th>
<th class="firstrow">Price Quoted </th>
<th class="firstrow"> Notes </th>
<th class="firstrow">Internal Notes</th>
<th colspan="3" class="firstrow2">
<div class="pcrsec">
<div class="row"><span class="pcrsecbor">Perior Customer RFQ</span></div>
<div class="row">
<div class="pcrsec2">
<ul class="list-inline">
<li>Date</li>
<li>Cust No</li>
<li>Price</li>
</ul>
</div>
</div>
</div>
</th>
<th colspan="3" class="firstrow3">
<div class="pcrsec">
<div class="row"><span class="pcrsecbor">Perior Customer P/O</span></div>
<div class="row">
<div class="pcrsec2">
<ul class="list-inline">
<li>Date</li>
<li>Cust No</li>
<li>Price</li>
</ul>
</div>
</div>
</div>
</th>
<th colspan="3" class="firstrow4">
<div class="pcrsec">
<div class="row"><span class="pcrsecbor">Perior Vendor P/O</span></div>
<div class="row">
<div class="pcrsec2">
<ul class="list-inline">
<li>Date</li>
<li>Cust No</li>
<li>Price</li>
</ul>
</div>
</div>
</div>
</th>
<th class="firstrow">MU%</th>
<th></th>
</tr>
</thead>
<tbody id="what_i_do">
<tr>
<td><input type="text" name="item_no[]"></td>
<td colspan="3">
<table>
<tr>
<td><input type="text" class="smlbox" name="part_no[]" onblur="checkavailpart(this)"></td>
<td><input type="number" class="smlbox" name="qty[]"></td>
<td>
<input type="number" class="smlbox price_quotd_cls" name="price_quotd[]">
</td>
</tr>
<tr>
<td colspan="3"><input type="text" class="smlbox2" name="part_desc[]"></td>
</tr>
</table>
</td>
<td><input type="text" name="part_note[]"></td>
<td><input type="text" name="part_internal_note[]"></td>
<td><input type="text" class="datepicker" name="pc_rfq_date[]"></td>
<td><input type="text" name="pc_rfq_cus_no[]"></td>
<td><input type="text" name="pc_rfq_price[]"></td>
<td><input type="text" class="datepicker" name="pc_po_date[]"></td>
<td><input type="text" name="pc_po_cus_no[]"></td>
<td><input type="text" name="pc_po_price[]"></td>
<td><input type="text" class="datepicker" name="pv_po_date[]"></td>
<td><input type="text" name="pv_po_cus_no[]"></td>
<td><input type="text" name="pv_po_price[]"></td>
<td><input type="text" name="mu_per[]" onblur="calculate_quote_rate(this)"></td>
<td><i class="fa fa-plus-circle fa-2x" onclick="what_i_do(this);"></i></td>
</tr>
</tbody>
附加html中的
:
divtest.innerHTML = '<td><input type="text" name="item_no[]"></td><td colspan="3"> <table> <tr> <td>.....
divtest.innerHTML='。。。。。
删除标记之间的所有空格首先确保提交按钮
位于表单
标记内,
然后,您可以将html代码附加到tbody
tag:#我做什么参考
t车身
标签
$(“#我做什么tr”).append(“+”html代码“+”);
尝试替换objTo.appendChild(divtest);使用$('#what_i_do').append(divtest.innerHTML);不客气,我很高兴能帮上忙。如果你能接受这个答案,那么其他人也可以使用它。谢谢
<script>
function what_i_do(that) {
initid++;
var objTo = document.getElementById('what_i_do');
var divtest = document.createElement("tr");
divtest.setAttribute("class", "removeclass" + initid);
divtest.setAttribute("id", "removeclass" + initid);
var rdiv = 'removeclass' + initid;
divtest.innerHTML = '<td><input type="text" name="item_no[]"></td><td colspan="3"> <table> <tr> <td><input type="text" class="smlbox" name="part_no[]" onblur="checkavailpart(this)"></td><td><input type="number" class="smlbox" name="qty[]"></td><td> <input type="number" class="smlbox price_quotd_cls" name="price_quotd[]"> </td></tr><tr> <td colspan="3"><input type="text" class="smlbox2" name="part_desc[]"></td></tr></table> </td><td><input type="text" name="part_note[]"></td><td><input type="text" name="part_internal_note[]"></td><td><input type="text" class="datepicker" name="pc_rfq_date[]"></td><td><input type="text" name="pc_rfq_cus_no[]"></td><td><input type="text" name="pc_rfq_price[]"></td><td><input type="text" class="datepicker" name="pc_po_date[]"></td><td><input type="text" name="pc_po_cus_no[]"></td><td><input type="text" name="pc_po_price[]"></td><td><input type="text" class="datepicker" name="pv_po_date[]"></td><td><input type="text" name="pv_po_cus_no[]"></td><td><input type="text" name="pv_po_price[]"></td><td><input type="text" name="mu_per[]" onblur="calculate_quote_rate(this)"></td><td><i class="fa fa-times-circle fa-2x" style="color:red" onclick="remove_education_fields(' + initid + ');"></i></td>';
objTo.appendChild(divtest);
}
</script>
divtest.innerHTML = '<td><input type="text" name="item_no[]"></td><td colspan="3"> <table> <tr> <td>.....
$("#what_i_do tr").append('<tr class="removeclass'+id+'" id="removeclass'+id+'">'+ 'html code'+ '</tr>');