Marco Della Gala
Posts: 0
Joined: Mon Mar 04, 2013 1:18 pm

invoke a service every x seconds automatically

Is it possible to invoke a service in automatic way every x seconds to refresh the data obtained by the REST service???
i'm working on a project where users can add content to the server periodically (Questions answers).
I already built a REST service which get these content form the server on load event. I have a refresh button to uptade contents, but i would like to invoke the servis automatically each 30 sec.
Is it possible????

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

invoke a service every x seconds automatically

Hi,

Yes, there is a JavaScript function setTimeout.
Run the following JavaScript code on Page load
codefunction runCode() {
serviceName.execute({})
setTimeout(runCode, 30000);
}
runCode();/code

Return to “Issues”