Controlling auto update in AJAX
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Suleman_Butt
Posted On:   Tuesday, May 16, 2006 09:44 AM

Ajax var ajax; function myResult() { ajax = new Ajax.Updater('results', '/dev/sbutt/RequestProxy/htdocs/?command=getResult', { method:'get' }); //if (value != "true") { window.setTimeout("myResult()", 4000); //} } window.setTimeout("myResult()", 4000); ]]>]]> Hi Folks, I have my question regarding the spawning of my url after fixed intervals, but based on the value of my flag variable. I have made my template file *index.tpl.html* the following: int i=1; {results} In the above code file, which i load using pet   More>>
Ajax

Hi Folks,
I have my question regarding the spawning of my url after fixed intervals, but based on the value of my flag variable. I have made my template file *index.tpl.html* the following:

			
int i=1;











{results}








In the above code file, which i load using pet.class.php (open src template prototype), the url

/dev/sbutt/RequestProxy/htdocs/?command=getResult


is being called after every 4 sec, now what i want is to control the execution of this setTimeout(..) method or through ajex somehow that the url should be trigerred only based upon the value of the *value* variable. The problem is that i dont know how to access or set the value of this variable *value*, through my php code, so that the setTimeout method is not called continuously.

I have other template variables in my php file like:

$template = new pet($templateFile);
$template->results = $myResult;



but how to set the *value* variable based upon some results or flag, so that url is not trigerred continuously every after 4 sec, is not handled by me. I hope i have not confused anybody with my problme description.
   <<Less
About | Sitemap | Contact