You can put the part in your template corresponding to the table in a separate .blade.php
file, and @include
that in your main layout.
main.blade.php
:
<html>
...
<body>
<div class="table-container">
@include('table')
</div>
</body>
...
And
table.blade.php
:
<table>
@foreach($rows as $row)
<tr>
<td> $row->title ... </td>
</tr>
@endforeach
</table>
In this way you can use a simple jQuery $('div.table-container').load(url)
and on your server just render and respond that part as an html string. return view('table', $data)
Javascript:
function refreshTable() {
$('div.table-container').fadeOut();
$('div.table-container').load(url, function() {
$('div.table-container').fadeIn();
});
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…