2 回答

TA貢獻1831條經驗 獲得超9個贊
這是有意義的解決方案。
步驟1)在按鈕中添加數據-###,并且它必須位于指定標題之前。
<a href="#"><i class="bx bxs-edit text-primary bx-sm edit" data-name="{{old('name') ?? $document->name}} " title="Edit Document"></i></a>
步驟2)在腳本中,您可以使用示例“$(this).data('name');”來獲取數據
<script type="text/javascript">
$(document).ready( function () {
//Getting the datatable ready
var table = $('#indextable').DataTable();
//if the edit button is clicked
table.on('click', '.edit', function(){
var nameData = $(this).data('name');
$("#name").val(nameData);
$('#editModal').modal('show');
});
});
//On error keep the modal open
@if (count($errors) > 0)
$('#editModal').modal('show');
@endif
</script>

TA貢獻1802條經驗 獲得超4個贊
例如,另一種選擇是重新刷新會話;
//On error keep the modal open
@if (count($errors) > 0)
{{ Session::reflash()}}
$('#editModal').modal('show');
@endif
old('value')然后您可以在模態視圖中使用標準語法。
- 2 回答
- 0 關注
- 179 瀏覽
添加回答
舉報