With JQuery ( light weight, super Java Script library) we can make call to API for fetching data or loading web page.
How about refresh or reload contents every 5 second ?
Steps
To auto reload the content we need the following
- Create function
- Set interval
Function
$(function () { // Function load content function fetchData(){ } });
Turn the data fetching portion of the AJAX call into JavaScript function inside the document ready jQuery function.
Set interval
setInterval(function(){ fetchData() },5000)
The setInterval will invoke the function every 5 second using the call back function.