ajax - Run a JS function on Server every 5 minutes -


i apologize if way i'm asking why haven't found answer yet, i've got simple js script makes ajax request , gets data api , stores it.

i'd put script on server , have run every 5 minutes, not client-side, server-side.

i've found resource called later.js not sure how set on server automatically initialize , run.

any appreciated!!!

it's hard know without exact code.

you should able jquery, like:

function foo () {    //your code here } foo(); //run function once on startup setinterval(foo, 5 * 60 * 1000) //and again every 5 minutes 

later.js is cool library calculating time in milliseconds, that's does. if have installed , required via npm, use like:

var 5min = later.parse.text('every 5 min'); setinterval(foo, 5min); 

as can see, might use standard js/jquery solve issue.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -