-
Page Refresh Timed Event
Hi all,
I'm working with an E-business app that uses servlets. I need a JavaScript
for a piece of functionality. I am checking a database to see if there is
a new record. What I need is for it to keep checkig every X seconds (X to
be feed to the JavaScript) once the time is reached it needs to call my check
method. Any ideas would be great.
Thanks!!!
-
Re: Page Refresh Timed Event
The Javascript function setTimeout is what you are looking for.
Let's say that your check function is called check(), and you want to run
this function every three seconds, the appropriate code would be:
while(true)
{
setTimeout("check()",3000);
}
This will call check() approx. every 3000 milliseconds (3 seconds).
If check() requires arguments, the code looks like this:
while(true)
{
setTimeout("check()",3000,arg1,arg2,etc);
}
Good luck. Make sure you break out of the while loop when you find the record
you are looking for.
"sanders" <cartier_eric@hotmail.com> wrote:
>
>Hi all,
>
>I'm working with an E-business app that uses servlets. I need a JavaScript
>for a piece of functionality. I am checking a database to see if there
is
>a new record. What I need is for it to keep checkig every X seconds (X
to
>be feed to the JavaScript) once the time is reached it needs to call my
check
>method. Any ideas would be great.
>
>Thanks!!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks