【发布时间】:2021-08-10 19:41:21
【问题描述】:
如何在不重新加载页面的情况下每 1 分钟将数据提取到 laravel foreach 在我的应用程序中,数据库中产品的价格每 1 分钟从 api 更改一次。我需要每 1 分钟在刀片中更改我的 foreach 中的产品价格,而无需重新加载页面
我的foreach
@foreach ($products as $product )
{{$product->id}}
{{$product->name}}
{{$product->price}}
@endforeach
【问题讨论】:
-
在 setInterval() 中使用 Ajax;
-
@NajamUsSaqib tanx 但如何??
-
让自己熟悉 polling、longpolling、server send events 和/或 websockets
标签: javascript jquery ajax laravel laravel-blade