Hi imoracle, To have a function called once every X seconds, you need to use setInterval() instead of setTimeout(). setTimeout() calls the function once, after a specific amount of time, while setInterval() continues calling the function until you clear the interval using clearInterval(). A quick search on Google came up with this page which explains both functions pretty well: http://www.elated.com/articles/javascript-timers-with-settimeout-and-setinterval/
Hope this helps, ~Arne On Sun, Feb 24, 2008 at 12:38 AM, imoracle <[EMAIL PROTECTED]> wrote: > > Hello All, > > I just want to make a callback to my remote app server every one > second, but some how don't get this working. > > Here is the code snippet: > > <ModulePrefs> > <Require feature="opensocial-0.7"/> > <Require feature="dynamic-height" /> > </ModulePrefs> > <Content type="html"> > <![CDATA[ > <script language="javascript" src="http://mysite.com/opensocial/ > library/js/coderunner.js<http://mysite.com/opensocial/library/js/coderunner.js> > "></script> > <script language="javascript"> > var polltime = 1000; > > function makeNormalRequest() { > var params = {}; > params[gadgets.io.RequestParameters.CONTENT_TYPE] = > gadgets.io.ContentType.TEXT; > var url = "http://www.mysite.com/opensocial/library/callbackstats/ > returndata.php<http://www.mysite.com/opensocial/library/callbackstats/returndata.php> > "; > gadgets.io.makeRequest(url, response, params); > }; > > function response(obj) { > //obj.text contains the text of the page that was requested > output(obj.text); > }; > > function onClickofButton() { > showapp(document.getElementById('Location').value); > document.getElementById('Location').value = ""; > document.getElementById('description').style.display = "none"; > document.getElementById('descriptionheader').innerHTML = "<b>Current > activity:</b>"; > document.getElementById('output').style.height = "260"; > setTimeout("makeNormalRequest()",polltime); > } > </script> > > > Can anyone help me with this? > > Also do we have xmlhttp request working in opensocial?? > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Orkut Developer Forum" group. To post to this group, send email to opensocial-orkut@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/opensocial-orkut?hl=en -~----------~----~----~----~------~----~------~--~---