![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hello, I was wondering if there was a way to have a javacript be activated by an input button that would call to a cgi program and querey every 10minutes and the cgi would update the page without additional user interaction. I found some timer stuff in js but it had to do with delays and not what I was really looking for. |
|
Thank you in advanced. |
#3
| |||
| |||
|
|
jason_box wrote on 05 mei 2006 in comp.lang.javascript: Hello, I was wondering if there was a way to have a javacript be activated by an input button that would call to a cgi program and querey every 10minutes and the cgi would update the page without additional user interaction. I found some timer stuff in js but it had to do with delays and not what I was really looking for. But .... CGI works on the server, and updating a page is done by the client. The CGI programme cannot press a clientside button, so the user has to presss it every 10 minutes? Where do you want the javascript to run? On the client browser, or on the server [under ASP]? What is the difference between waiting and a delay? Thank you in advanced. Not that advanced I hope. -- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress) |
#4
| |||
| |||
|
|
Hello, Thank you for your quick response. I should clarify myself if my question was a little confusion. The cgi script just calls to a local server to output some data from the server which works. On the html page I wanted a javascript that would be activiated and call the cgi program and call to the cgi every 5-10minutes. The cgi will already outputs the data to the main html page but I would like it to be only active when a user wants the data. Since I do not want to over request from the server, the javascript should just call to the cgi every 10minutes until the user press a stop button whcih cuases the javascript to stop. I think this can be done with on() and off() functions but I was not sure how to do this yet. The javascript will be ran through the client side so of course it will require some interaction. I hope this clears up any confusion. Thank you again. |
#5
| |||
| |||
|
|
button onclick='var tmt = setInterval("doCallServer()",10*60*1000)' start</button button onclick='clearInterval(tmt)' stop</button |
|
onclick='var tmt = setInterval("doCallServer()",10*60*1000)' |
#6
| |||
| |||
|
|
button onclick='var tmt = setInterval("doCallServer()",10*60*1000)' start</button button onclick='clearInterval(tmt)' stop</button Which part of the segment of code do I make the call to the cgi program? |
|
I was thinking of using general input forms and have it submit and post to cgi, but that would still leave me with the timing issue. |
|
onclick='var tmt = setInterval("doCallServer()",10*60*1000)' 10*60*1000, what units is this in? |
#7
| |||
| |||
|
|
button onclick='var tmt = setInterval("doCallServer()",10*60*1000)' start</button button onclick='clearInterval(tmt)' stop</button Which part of the segment of code do I make the call to the cgi program? |
|
I was thinking of using general input forms and have it submit and post to cgi, but that would still leave me with the timing issue. |
|
Also on another note, on this line onclick='var tmt = setInterval("doCallServer()",10*60*1000)' 10*60*1000, what units is this in? |
#8
| |||
| |||
|
|
you'll need to create your function doCallServer() i.e : to submit your form nammed 'myForm' function doCallServer() { document.forms['myForm'].submit(); } |
#9
| |||
| |||
|
|
onclick='var tmt = setInterval("doCallServer()",10*60*1000)' 10*60*1000, what units is this in? milliseconds and should probably be hard coded as 600000 instead of the browser doing multiplication every time. |
#10
| |||
| |||
|
![]() |
| Thread Tools | |
| Display Modes | |
| |