You are right there, but that doesn't seem to be the intent of the OP though, even if it's a safer approach :)
-N On 8/28/07, Diodeus <[EMAIL PROTECTED]> wrote: > > I am reluctant to use setInterval in this type of application. If you > do not get a response within the specified time you risk firing off a > request before the first one has been completed. You never know what > the server will be up to. I find it preferable to call the setTimeout > again upon successful completion of the request. > > On Aug 28, 4:35 pm, "Nicolás Sanguinetti" <[EMAIL PROTECTED]> wrote: > > for repeating execution you need setInterval, setTimeout only calls it > > once, or better yet (at least if you need more control) use > > Prototype's PeriodicalExecuter. > > > > -foca > > > > On 8/28/07, Diodeus <[EMAIL PROTECTED]> wrote: > > > > > > > > > Yes, in this case use > > > Ajax.Request:http://www.prototypejs.org/api/ajax/request > > > > > ..then just use setTimeout to keep calling the function periodically. > > > > > On Aug 28, 1:12 pm, S <[EMAIL PROTECTED]> wrote: > > > > Yes, I'm a newbie in using Ajax and I don't use javascript a lot > > > > either ( I didn't even know what JSON was :P ). I was trying to save > > > > the value returned by Ajax.PeriodicalUpdater, which I realized later > > > > that it's not gonna work. It only updates the value inside div > > > > directly. In that case, I'm forced to go to a totally different > > > > direction. Thanks Diodeus and Michael for your suggestions. I really > > > > appreciate it :) > > > > > > On Aug 27, 3:30 pm, Diodeus <[EMAIL PROTECTED]> wrote: > > > > > > > While I generally use JSON myself, judging from the skill level of the > > > > > original poster, I would expect JSON would be a bit of a leap. > > > > > > > On Aug 27, 3:17 pm, Michael Peters <[EMAIL PROTECTED]> wrote: > > > > > > > > Diodeus wrote: > > > > > > > Create some sort of unique delimiter in your responsedatastring to > > > > > > > separate the elements, such as "~". > > > > > > > > You could do that, but then you're limiting yourself (limiting > > > > > > yourself to just > > > > > > arrays and whatdatacan be in those arrays). Why not just use JSON? > > > > > > Convert > > > > > > your PHP structure (array or hash) into a JSON string and then send > > > > > > it over the > > > > > > wire. > > > > > > > > > Then turn the string into an array using (use your own variable > > > > > > > names): > > > > > > > > > mydata = myResponseText.Split('"~") > > > > > > > > > mydata[0] will contain the first element, mydata[1] the second > > > > > > > etc. > > > > > > > > This would then become > > > > > > > > mydata = myResponseText.evalJSON(); > > > > > > > > -- > > > > > > Michael Peters > > > > > > Developer > > > > > > Plus Three, LP- Hide quoted text - > > > > > > > - Show quoted text - > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
