Page 1 of 1

invoke a service every x seconds automatically

Posted: Thu Mar 07, 2013 9:15 am
by Marco Della Gala

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????


invoke a service every x seconds automatically

Posted: Thu Mar 07, 2013 9:30 am
by Kateryna Grynko

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


invoke a service every x seconds automatically

Posted: Thu Mar 07, 2013 9:35 am
by Marco Della Gala

thanKs