I want to load data frequently after 60 seconds without page refreshing. The line of code is
<div id="callmeauto">@include('custome.myquestionodds')</div>
The code in “myquestionodds.blade.php” in where the data is fetching. It is working fine. But I want to call this blade php file frequently and show in “callmeauto” div. I tried some codes from here there. But not working. As example below. I am sure I am in the wrong direction.
$(document).ready(function() {
$('#callmeauto').load('/custome/myquestionodds');
});
3
Answers
Error:
use
setInterval
with 60 secondsA better way to use frontend framework to fetch data from endpoint in JSON format.
For example you can try to use Vue.js framework.
It in simple case your problem will be solved like that.
In your template you just use template syntax:
To use vue.js you will need to install it. Also axios library for making ajax calls.
The eases way via CDN: