gpt4 book ai didi

jquery - 不从引导模式中删除

转载 作者:行者123 更新时间:2023-12-04 03:58:39 25 4
gpt4 key购买 nike

正如您所看到的这些代码,分页中的删除按钮在没有引导模式的情况下工作正常,然后转换为引导模型,一旦单击删除按钮,引导模型就可以正常工作,但问题不是删除它或做没有。我不知道我错过了什么,我可能是身份证号或 jquery,我急需帮助。

前缘

              <thead>
<tr class="center">
<th>ID</th>
<th>Account ID</th>
<th>Password</th>
<th>Company Name</th>
<th>Restocking Fee</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
<tbody>
@foreach($resellers as $reseller)
<tr>
<td>{{ $reseller-> id }}</td>
<td>{{ $reseller-> accountid }}</td>
<td>{{ $reseller-> password }}</td>
<td>{{ $reseller-> companyname }}</td>
<td>{{ $reseller-> restockingfee }}</td>
<td>{{ $reseller-> active}}</td>
<td class="center">

<form action="{{ url('/admin/resellers', $reseller->id) }}" method="POST">
<strong><a href="/admin/resellers/{{ $reseller->id }}" class="btn btn-primary btn-sm btn-mini" >
<i class="fas fa-pen fa-fw"></i>View</a></strong>
@method('DELETE')
@csrf
<button class="btn btn-secondary btn-sm btn-mini"><i class="far fa-edit fa-fw"></i>Edit


<a href="#" style="color:black; font-weight: bold;" data-href="{{ url('/admin/resellers/{reseller}', $reseller->id) }}"
class="btn btn-info btn-outline btn-circle btn-lg" data-toggle="modal" data-target="#myModal" title="Delete">Delete</a>
</form>

</td>
</tr>

@endforeach
</tbody>

<tfoot>
<tr>
<th>ID</th>
<th>Account ID</th>
<th>Password</th>
<th>Company Name</th>
<th>Restocking Fee</th>
<th>Status</th>
<th>Action</th>
</tr>
</tfoot>
</table>
</div>

模态

<!-- Delete Modal -->
<div class="container">
<div class="modal fade" id="myModal" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Delete !!!</h4>
</div>
<div class="modal-body text-center">
<p class="my-0 font-weight-bold">Are you sure you want to delete this data???</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<a class="btn btn-danger btn-ok">Delete</a>
</div>
</div>
</div>
</div>
</div>

j查询

<script>
$('#myModal').on('show.bs.modal', function(e) {
$(this).find('.btn-ok').attr('href', $(e.relatedTarget).data('href'));
});
</script>

Controller

   public function destory(\App\Reseller $reseller){

$reseller -> delete();

return redirect ('/admin/resellers');
}

最佳答案

在你的 Blade 上,在 form 之外(不是在 form 中)执行此操作:


@foreach($resellers as $reseller)
<tr>
<td>{{ $reseller->id }}</td>
<td>{{ $reseller->accountid }}</td>
<td>{{ $reseller->password }}</td>
<td>{{ $reseller->companyname }}</td>
<td>{{ $reseller->restockingfee }}</td>
<td>{{ $reseller->active}}</td>
<td class="center">

<a href="#" style="color:black; font-weight: bold;" data-href="{{ url('/admin/resellers/', $reseller->id) }}" class="btn btn-info btn-outline btn-circle btn-lg" data-toggle="modal" data-target="#myModal" title="Delete">Delete</a>

</td>
</tr>
@endforeach

这是模态数据:

<!-- Delete Modal -->
<div class="container">
<div class="modal fade" id="myModal" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Delete !!!</h4>
</div>
<div class="modal-body text-center">
<p class="my-0 font-weight-bold">Are you sure you want to delete this data???</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<a class="btn btn-danger btn-ok">Delete</a>
</div>
</div>
</div>
</div>
</div>

<!-- Delete Modal JS -->
<script>
$('#myModal').on('show.bs.modal', function(e) {
$(this).find('.btn-ok').attr('href', $(e.relatedTarget).data('href'));
});
</script>

关于jquery - 不从引导模式中删除,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63452799/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com