我真的很新推出Laravel Blades中的Ajax。我一直在寻找教程等,但它很混乱。我希望你能耐心等待我Laravel Blade中的Ajax
所以我有一个刀片,我想应用Ajax,因此它可能会每秒刷新一次。
我想知道在整个页面上应用Ajax是否可取。
如果没有,这里是我要使用Ajax的刀片部分(它在forelse中);
<div class="row">
@forelse($receipt_ids as $receipt_id)
<div class="col-md-4">
<div class="panel panel-default">
<div class="panel-heading text-center">
{{$receipt_id->receipt_id}}
</div>
<div class="panel-body">
<table class="table table-bordered table-responsive">
<thead>
<th>Name</th>
<th>Quantity</th>
</thead>
<tbody>
@foreach($orders as $order)
@if($receipt_id->receipt_id == $order->receipt_id)
<tr>
<td>{{$order->item}}</td>
<td>{{$order->qty}}</td>
</tr>
@endif
@endforeach
</tbody>
</table>
</div>
<div class="panel-footer clearfix">
<button type="submit" class="btn btn-success pull-right" style="margin-right: 10px;">
<i class="fa fa-check-circle" aria-hidden="true"></i> Served
</button>
</div>
</div>
</div>
@empty
@endforelse
</div>
我有一种感觉,阿贾克斯将与时间变化或东西。
编辑:我现在有一个领导。我用了;
<script type="text/javascript">
$(document).ready(function() {
setInterval(function()
{
alert('test');
}, 2000)
});
</script>
现在我的问题是我可以做什么语法来刷新页面?
谢谢!或多或少我现在领先,哈哈。我尝试使用该功能,并提出警告来测试它。现在我将尝试使用'$ .get'。我编辑了我的主帖,我的JavaScript正在工作。 –