我有以下需要将用户 ID 传递给 PHP 脚本的 ajax。
document.getElementById("delete").addEventListener("click", function(){
if (confirm("Are you sure you want to delete this user's account?")) {
$.ajax({
url: 'deleteUser.php?id='+<?php echo $userID ?>,
success: function(data) {
toastr.danger("User successfully deleted!");
}
});
} else {
}
});
我不确定如何从使用的按钮中实际获取行数据,因为它们在通过集合中的每条记录时发布在每行的 TD 中。如何做到这一点?
<table class="table table-bordered">
<thead class="thead-dark">
<tr>
<th scope="col">First Name</th>
<th scope="col">Last Name</th>
<th scope="col">Email</th>
<th scope="col">Username</th>
<th scope="col">Account Type</th>
<th scope="col">Actions</th>
</tr>
</thead>
<tbody>
万千封印
慕姐8265434
四季花海
随时随地看视频慕课网APP