【发布时间】:2015-02-14 10:01:29
【问题描述】:
我正在为我的 Laravel 应用程序实现 jQueryUI,我想要一个删除确认,但我没有实现一个。这是我的代码:
@foreach(array_chunk($items->all(), 3) as $row)
<div class="row" style="margin-bottom:40px;">
@foreach ($row as $item)
<div class="col-md-4">
<img src="{{$item->img_loc}}">
<div>
<strong>Breed: </strong>{{ $item->bname}}<br/>
<strong>GameFarm: </strong>{{ $item->g_origin}}<br/>
<strong>Leg Band: </strong>{{ $item->lband}}
<h3><a href="{{ action('GamefarmsController@edit', $item->id) }}" >Edit</a>|<a id="thelink" href="#">Delete</a></h3>
</div>
</div>
@endforeach
这是我的 jQuery:
<script>
$(function()
{
$( "#dialog-confirm" ).dialog(
{
autoOpen: false,
resizable: false,
height:140,
modal: true,
buttons:
{
"Delete": function()
{
$( this ).dialog( "close" );
},
Cancel: function()
{
$( this ).dialog( "close" );
}
}
});
});
</script>
我想通过这段代码让程序重定向到我的控制器,这会携带 $items->id 在顶部代码中循环,就像编辑一样。
{{ action('GamefarmsController@delete', $item->id) }}
我尝试对此代码进行试验,但没有任何反应。
编辑:这是剩余的脚本:
<script type="text/javascript">
$(document).ready(function(){
$('#thelink').click(function(){ $('#dialog-confirm').dialog('open'); });
});
</script>
【问题讨论】:
-
您现在是否收到确认对话框,如果是,请发布整个 jquery 代码
-
是的,等我更新一下
-
检测用户是否确认删除的功能是什么?
-
这是我在更新中发布的最后一个代码
标签: php jquery mysql laravel blade