jin1212-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2008-Jan-22 00:03 UTC
prototype 1.6 Ajax.PeriodicalUpdater executing old scripts??
Hello , I have a PeriodicalUpdater executing every x seconds and sends a ajax request to update an element. Each time it comes back, the element is getting replaced with some html and and possibly <script>coolFunction()</script>. This seems to work fine when for prototype 1.5. However when I upgraded to prototype 1.6, it seems to execute coolFunction() as many times as the request has been called. For example: the PeriodicalUpdater has already send out 5 request already without <script>coolFunction</script>, on the 6th one the response has a <script>coolFunction</script>. Prototype will call coolFunction six times. What is the problem here? I didnt used to have it when I used prototype 1.5 Any help is appreciated --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Justin Perkins
2008-Jan-22 03:12 UTC
Re: prototype 1.6 Ajax.PeriodicalUpdater executing old scripts??
On Jan 21, 2008 6:03 PM, jin1212-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <jin1212-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> For example: the PeriodicalUpdater has already send out 5 request > already without <script>coolFunction</script>, on the 6th one the > response has a <script>coolFunction</script>. Prototype will call > coolFunction six times.Well that doesn''t sound right at all. Do you have an example page or at least the HTML/JavaScript that can be used to reproduce this? -justin --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
jin1212-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2008-Jan-22 14:41 UTC
Re: prototype 1.6 Ajax.PeriodicalUpdater executing old scripts??
HTML: ---------------------------------------------------------------------------------------- <html> <head></head> <body onload="start()"> <div id="status"></div> </div> </html> ---------------------------------------------------------------------------------------- JAVASCRIPT: ---------------------------------------------------------------------------------------- function start(){ new Ajax.PeriodicalUpdater(''status'', ''url'', { method: ''get'', parameters: "action_word=checkTimeout'', evalScripts: true, frequency: 5, decay: 1 }); } function coolFunction(){ alert("I''m cool"); } ---------------------------------------------------------------------------------------- SERVER: ---------------------------------------------------------------------------------------- 1st response 5 secs <input type="hidden" name="timeout" value="" /> 2nd response 10 secs <input type="hidden" name="timeout" value="" /> 3rd response 15 secs <input type="hidden" name="timeout" value="" /><script>coolFunction();</script>100th response 500 secs <input type="hidden" name="timeout" value="" /><script>coolFunction();</script>---------------------------------------------------------------------------------------- On the browser: ---------------------------------------------------------------------------------------- 1st response 5 secs nothing 2st response10 secs nothing 3st response 15 secs I see alert("I''m cool) 3 times 100th response 500 secs alerts gets called 100 times ---------------------------------------------------------------------------------------- I know it doesnt make sense, but that''s what I''m seeing. Maybe I''m doing something stupid but why did it work in 1.5 and not work in 1.6. On Jan 21, 9:12 pm, "Justin Perkins" <justinperk...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Jan 21, 2008 6:03 PM, jin1...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <jin1...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > For example: the PeriodicalUpdater has already send out 5 request > > already without <script>coolFunction</script>, on the 6th one the > > response has a <script>coolFunction</script>. Prototype will call > > coolFunction six times. > > Well that doesn''t sound right at all. Do you have an example page or > at least the HTML/JavaScript that can be used to reproduce this? > > -justin--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Matt Foster
2008-Jan-22 21:36 UTC
Re: prototype 1.6 Ajax.PeriodicalUpdater executing old scripts??
Someone else was just talking about the PU concatenating results instead of overwriting them. http://groups.google.com/group/rubyonrails-spinoffs/browse_thread/thread/22249f33eed9876a#84d82d160cc6bc7c If this is an error, it would be a very simple patch. On Jan 22, 9:41 am, "jin1...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <jin1...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> HTML: > > ---------------------------------------------------------------------------------------- > <html> > <head></head> > <body onload="start()"> > <div id="status"></div> > </div> > </html> > ---------------------------------------------------------------------------------------- > > JAVASCRIPT: > ---------------------------------------------------------------------------------------- > function start(){ > new Ajax.PeriodicalUpdater(''status'', ''url'', > { > method: ''get'', > parameters: "action_word=checkTimeout'', > evalScripts: true, > frequency: 5, > decay: 1 > }); > > } > > function coolFunction(){ > alert("I''m cool");} > > ---------------------------------------------------------------------------------------- > > SERVER: > ---------------------------------------------------------------------------------------- > 1st response 5 secs > <input type="hidden" name="timeout" value="" /> > 2nd response 10 secs > <input type="hidden" name="timeout" value="" /> > 3rd response 15 secs > <input type="hidden" name="timeout" value="" /><script>coolFunction();</script> > > 100th response 500 secs > <input type="hidden" name="timeout" value="" / > > ><script>coolFunction();</script> > > ---------------------------------------------------------------------------------------- > > On the browser: > ---------------------------------------------------------------------------------------- > 1st response 5 secs > nothing > 2st response10 secs > nothing > 3st response 15 secs > I see alert("I''m cool) 3 times > 100th response 500 secs > alerts gets called 100 times > ---------------------------------------------------------------------------------------- > > I know it doesnt make sense, but that''s what I''m seeing. Maybe I''m > doing something stupid but why did it work in 1.5 and not work in 1.6. > > On Jan 21, 9:12 pm, "Justin Perkins" <justinperk...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > On Jan 21, 2008 6:03 PM, jin1...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <jin1...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > For example: the PeriodicalUpdater has already send out 5 request > > > already without <script>coolFunction</script>, on the 6th one the > > > response has a <script>coolFunction</script>. Prototype will call > > > coolFunction six times. > > > Well that doesn''t sound right at all. Do you have an example page or > > at least the HTML/JavaScript that can be used to reproduce this? > > > -justin--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Apparently Analagous Threads
- Does Ajax.PeriodicalUpdater have a shield against multiple parallel executions?
- RE: Prototype: correct useage of onComplete withAjax.PeriodicalUpdater
- PeriodicalUpdater onComplete broken?
- RE: Prototype: correct useage of onCompletewithAjax.PeriodicalUpdater
- dynamically change frequency in periodicalUpdater