[英]I try to replace the delete button tag to anchor tag but it's was not worked
deleting action form can't worked I think but i try to solve this error but unsuccessful 我认为删除操作表单无法正常工作,但我尝试解决此错误,但未成功
My Delete button tag code that's in working condition in front end and back end . 我的“删除”按钮标签代码在前端和后端处于工作状态。 But when i use anchor tag on the replace button the not worked. 但是,当我在替换按钮上使用锚标签时,该按钮不起作用。
I put both code that's first is delete button code in working condition and second is my anchor tag code. 我把两个代码都放在了工作状态,第一个是删除按钮代码,第二个是我的锚标记代码。
<td>
<form method="post" class="delete_form" action="{{action('PostController@destroy', $row['id'])}}">
{{csrf_field()}}
<input type="hidden" name="_method" value="DELETE" />
<button type="submit" class="btn btn-danger"><i class="fa fa-trash"></i></button>
</form>
</td>
this is my anchor code code that's not worked 这是我的锚码无效
<td>
<form method="post" class="delete_form" action="{{action('PostController@destroy', $row['id'])}}">
{{csrf_field()}}
<input type="hidden" name="_method" value="DELETE" />
<a href=""><i class="fa fa-trash"></i></a>
</form>
</td>
error message on address bar of browser:- mywebsite/posts/id=1 Delete action can't performed. 浏览器地址栏上的错误消息:-mywebsite / posts / id = 1无法执行删除操作。
I want to use this font awesome icon in my all project but in this field anchor tag not worked 我想在我的所有项目中使用该字体真棒图标,但是在此字段中,锚标记不起作用
<i class="fa fa-trash">
I think you are missing some tags, So If you want to submit form using anchor
, use this 我认为您缺少一些标签,因此,如果要使用anchor
提交表单,请使用
<td>
<form method="post" id="my_form" class="delete_form" action="{{action('PostController@destroy', $row['id'])}}">
{{csrf_field()}}
<input type="hidden" name="_method" value="DELETE" />
<a href="javascript:{}" onclick="document.getElementById('my_form').submit();"><i class="fa fa-trash"></i></a>
</form>
</td>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.