我正在处理project.in,我希望通过clientid获取数据并将其填充到其余字段。(仅为了方便用户).i已经完成了它。但它没有处理弹出窗口和身体建议我是好方法或指导我在哪里犯错误。
html代码:
<table class="table table-bordered">
<tr>
<th>
Client Id
</th>
<th>
Client Name
</th>
<th>
Client Number
</th>
<th>
Address
</th>
</tr>
<tr>
<td>
<input class="form-control" type='text' id="countryname_1" />
</td>
<td>
<input class="form-control" type='text' id="country_no_1"/>
</td>
<td>
<input class="form-control" type='text' id="phone_code_1" />
</td>
<td>
<input class="form-control" type='text' id="country_code_1" />
</td>
</tr>
</table>
ajax代码:
<?php
require_once 'config.php';
if($_POST['type'] == 'country_table'){
$row_num = $_POST['row_num'];
$name = $_POST['name_startsWith'];
$query = "SELECT clientId, clientName, contactNo, address FROM clients";
$result = mysqli_query($con, $query);
$data = array();
while ($row = mysqli_fetch_assoc($result)) {
$name = $row['clientId'].'|'.$row['clientName'].'|'.$row['contactNo'].'|'.$row['address'].'|'.$row_num;
array_push($data, $name);
}
echo json_encode($data);
}?>
此代码单独工作。不在popup.any建议