i using resource controller comments. have link delete comment in blade.
<a href="" ><span class="glyphicon glyphicon-trash delete"></span></a>
if click on jquery dialog pop ups. code dialog box below.
jquery(document).ready(function($){ $('.edit-delete span.delete').click(function(e){ e.preventdefault(); $('<div id="dialog" class="pull-center"></div>').appendto('body').html('<div"><h4>are sure want delete comment?</h4></div>') .dialog({ autoopen: true, modal : true, title : 'confirm', buttons: { "yes" : function(){ $(this).dialog('close'); $(location).attr("href", " {{what put here?}} "); }, "no" : function(){ $(this).dialog('close'); } } }); }); });
but no surprise redirect not work need use delete method.how achieve that?
in {{what put here?}}
section want link laravel route, this
{{ route('routename', ['id' => $comment->id]) }}
see https://laravel.com/docs/5.2/routing#named-routes
note need use method, might more normal use form , can use put or delete might make more sense in case, alternatively use ajax sort of request.
Comments
Post a Comment