Page 1 of 1

How to update page automatically?

Posted: Fri Apr 10, 2015 5:03 am
by Nicklas

I want a page to refresh automatically every 60 sec. Can some one show me a javascript for that?
Thanks!


How to update page automatically?

Posted: Fri Apr 10, 2015 5:31 am
by Nicklas

Or actually invoke service after every 60 sec


How to update page automatically?

Posted: Fri Apr 10, 2015 5:57 am
by She

Hi Nicklas,

setTimeout(function()
{
Do something here. . .
},
miliseconds of 60sec here. . .
);

Goodluck,


How to update page automatically?

Posted: Fri Apr 10, 2015 7:26 am
by Nicklas

Thanks!
But What do I need to put in to "Do something here"?


How to update page automatically?

Posted: Fri Apr 10, 2015 8:06 am
by She

Hi Nick,

type the service that you want to execute, for example:

sampleService.execute();

Goodluck,


How to update page automatically?

Posted: Fri Apr 10, 2015 8:08 am
by Mark Wong

If you mean refresh is invoking service, such as list service then,
code
var renew = setInterval(function()
{Service.execute({}); }, 60000);
/code
/* Replace 60000 milliseconds(60 secs) to How LONG you want /
/ Replace "Service" to your own service trying to refresh */

http://stackoverflow.com/questions/72...
setTimeout only execute once after a period of time you've set.


How to update page automatically?

Posted: Fri Apr 10, 2015 8:25 am
by Nicklas

Thanks! And where could I Run this script? LoadPage?


How to update page automatically?

Posted: Fri Apr 10, 2015 9:03 am
by Nicklas

Thanks! Works perfect!


How to update page automatically?

Posted: Thu Mar 24, 2016 6:08 pm
by jmd2004

how can i refresh the label? For example i would like my web service to run every 5 seconds and then automatically change the label with one of the values.


How to update page automatically?

Posted: Thu Mar 24, 2016 7:47 pm
by Serhii Kulibaba

Hello,

Please use setInterval to run your service each 5 seconds, as Mark said above.:
prevar renew = setInterval(function(){
Service.execute({});
}, 5000);/pre