当用户单击按钮(+)的行将增加时,我正在为暴露项目创建 该表有
2dropdown-帐户代码,按ajax和sql排序 2textarea-详细信息,注意 2文本框-金额,单位 1按钮-用于在订单行中上传图片
function fncAdd(){
var tb = document.getElementById('tbl');
var tbody = document.createElement('tbody');
tb.insertBefore(tbody, null);
tr = document.createElement("tr");
tbody.insertBefore(tr, null);
td = document.createElement("td");
var id = document.createTextNode("");
td.insertBefore(id, null);
tr.insertBefore(td, null);
td = document.createElement("td");
var se = document.createElement("select");
se.setAttribute('id','accountcode');
se.options[0] = new Option(" - - Please select - - ","");
se.options[0].selected =1;
td.insertBefore(se, null);
tr.insertBefore(td, null);
td = document.createElement("td");
se = document.createElement("select");
se.setAttribute('id','item');
se.options[0] = new Option(" - - Select accountcode first - - ","");
se.options[0].selected =1;
td.insertBefore(se, null);
tr.insertBefore(td, null);
tb.appendChild(tbody);
}
Ajax
<?php
include 'dbConfig.php';
$query = $db->query("SELECT * FROM accountcode ORDER BY acc_id ASC ");
$rowCount = $query->num_rows;
?>
<td>
<select id="accountcode" class="accountcode">
<option value=""> - - Please select - - </option>
<?php
if($rowCount > 0){
while($row=$query->fetch_assoc()){
echo '<option value="'.$row['acc_id'].'">'.$row['acc_name'].'</option>';
}
}else{
echo '<option value="">Accountcode not available</option>';
}
?>
我遇到了麻烦。我无法在fncAdd中输入ajax条件 如果进入它。 fnc添加其不起作用。 我希望新行中的下拉菜单具有ajax条件