如何在以下代码中使用数组来从php中的数组读取数据?实际上在循环中,我写了这样的东西,但我知道我如何在下面的代码中完成上面的数组
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function() {
$(".add-row").click(function() {
//var name = $("#name").val();
//var quantity = $("#quantity").val();
//var email = $("#email").val();
var markup = "<tr><td><input type='checkbox' name='record'></td><td> <input type='text' name='name'> </td><td> <input type='text' name='quantity'> </td><td> <input type='text' name='email'> </td></tr>";
$("table tbody").append(markup);
});
// Find and remove selected table rows
$(".delete-row").click(function() {
$("table tbody").find('input[name="record"]').each(function() {
if ($(this).is(":checked")) {
$(this).parents("tr").remove();
}
});
});
});
</script>
<body>
<form>
<input type="button" class="add-row" value="Add Row">
</form>
<table>
<thead>
<tr>
<th>Select</th>
<th>Name</th>
<th>Quantity</th>
<th>Email</th>
</tr>
</thead>
<tbody>
<tr>
<td><input type="checkbox" name="record"></td>
<td><input type="text" id="name" /></td>
<td><input type="text" id="quantity" /></td>
<td><input type="text" id="email" /></td>
</tr>
</tbody>
</table>
<button type="button" class="delete-row">Delete Row</button>
</body>
喵喵时光机
小唯快跑啊