Reputation: 69
What do I need to do in order to make a call to an API, retrieve some data in JSON format and then store that data into a database. I know the specifics of this process, but the thing is I need this to be done at an interval of 5 minutes and without placing burden on the loading time of the website. So, I don't know the concept of how this is done because it obviously can't be done when the page is loaded, hence it has to be done by the server, but how ?
Any useful reading material regarding this topic would also come in handy. Thanks.
Upvotes: 0
Views: 1822
Reputation: 2072
Take a look at the new web workers method in HTML 5.
http://www.w3schools.com/html/html5_webworkers.asp
You tagged this as a jquery question so I assume you already know how to make an ajax call. If you know how to make an ajax call Im sure you can figure out how to use setInterval to make this repeat every x number of seconds. But just in case take a look at this:
http://www.w3schools.com/jsref/met_win_setinterval.asp
This is assuming you want to do this on the page itself, otherwise as others have commented just set up a cron job.
Upvotes: 1