Hi, I''m new to prototype and am having a problem with Ajax.Request. I find that it basically just loops round and round and round forever, and never finishes. // uses ajax to attempt to connect to a database. Inserts either yes or no into error div function form_db(server, username, password, name) { //alert(''hi''); new Ajax.Request(''ajax_handler.php'', { method:''get'', onSuccess: function(transport){ var response = transport.responseText || "no response text"; alert("Success! \n\n" + response); }, onFailure: function(){ alert(''Something went wrong...'') } }); } This just constantly alerts "success + " the correct response from php, but it alerts again and again and again and never stops! If I comment out the prototype code and uncomment alert(''hi''), that only alerts once so it must be a problem with the prototype usage. Could someone explain to me how to get it to just do one request then finish? Thanks, Simon --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Any ideas? Apologies for what is probably a rather silly question, but I''ve not had this problem when I made my own Ajax requester a while back, and the docs haven''t explained to me how this one works - why would it loop like this?! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Frederick Polgardy
2008-Jun-04 15:42 UTC
Re: Ajax.Request - how to stop it going in constant loop?!
I can''t think of any reason why you''re seeing this. Can you post a complete page that demonstrates this? You might be calling form_db() over and over and not realizing it. Hard to tell. On Wed, Jun 4, 2008 at 4:37 AM, sheps-ii <simonrshepherd-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> > Hi, > I''m new to prototype and am having a problem with Ajax.Request. I find > that it basically just loops round and round and round forever, and > never finishes. > > // uses ajax to attempt to connect to a database. Inserts either yes > or no into error div > function form_db(server, username, password, name) > { > //alert(''hi''); > new Ajax.Request(''ajax_handler.php'', > { > method:''get'', > onSuccess: function(transport){ > var response = transport.responseText || "no response text"; > alert("Success! \n\n" + response); > }, > onFailure: function(){ alert(''Something went wrong...'') } > }); > > } > > This just constantly alerts "success + " the correct response from > php, but it alerts again and again and again and never stops! If I > comment out the prototype code and uncomment alert(''hi''), that only > alerts once so it must be a problem with the prototype usage. Could > someone explain to me how to get it to just do one request then > finish? > > Thanks, > Simon > > >-- Science answers questions; philosophy questions answers. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
voracious_reader
2008-Jun-04 17:07 UTC
Re: Ajax.Request - how to stop it going in constant loop?!
I have the same issue. I''m using Ajax.PeriodicalUpdater. I want to stop making calls based on condition. How do I do it? On Jun 4, 8:42 am, "Frederick Polgardy" <f...-SMQUYeM9IBBWk0Htik3J/w@public.gmane.org> wrote:> I can''t think of any reason why you''re seeing this. Can you post a complete > page that demonstrates this? You might be calling form_db() over and over > and not realizing it. Hard to tell. > > On Wed, Jun 4, 2008 at 4:37 AM, sheps-ii <simonrsheph...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> > wrote: > > > > > > > Hi, > > I''m new to prototype and am having a problem with Ajax.Request. I find > > that it basically just loops round and round and round forever, and > > never finishes. > > > // uses ajax to attempt to connect to a database. Inserts either yes > > or no into error div > > function form_db(server, username, password, name) > > { > > //alert(''hi''); > > new Ajax.Request(''ajax_handler.php'', > > { > > method:''get'', > > onSuccess: function(transport){ > > var response = transport.responseText || "no response text"; > > alert("Success! \n\n" + response); > > }, > > onFailure: function(){ alert(''Something went wrong...'') } > > }); > > > } > > > This just constantly alerts "success + " the correct response from > > php, but it alerts again and again and again and never stops! If I > > comment out the prototype code and uncomment alert(''hi''), that only > > alerts once so it must be a problem with the prototype usage. Could > > someone explain to me how to get it to just do one request then > > finish? > > > Thanks, > > Simon > > -- > Science answers questions; philosophy questions answers.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Frederick Polgardy
2008-Jun-04 17:13 UTC
Re: Ajax.Request - how to stop it going in constant loop?!
You can call .stop() on your periodical updater object once you''ve created it. Just have to save it away.... var updater = new Ajax.PeriodicalUpdater(...); if (someCondition) updater.stop(); Different issue - what the OP posted doesn''t involve a PeriodicalUpdater. On Wed, Jun 4, 2008 at 12:07 PM, voracious_reader <swati.rk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > I have the same issue. I''m using Ajax.PeriodicalUpdater. I want to > stop making calls based on condition. How do I do it? > > On Jun 4, 8:42 am, "Frederick Polgardy" <f...-SMQUYeM9IBBWk0Htik3J/w@public.gmane.org> wrote: > > I can''t think of any reason why you''re seeing this. Can you post a > complete > > page that demonstrates this? You might be calling form_db() over and > over > > and not realizing it. Hard to tell. > > > > On Wed, Jun 4, 2008 at 4:37 AM, sheps-ii <simonrsheph...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> > > wrote: > > > > > > > > > > > > > Hi, > > > I''m new to prototype and am having a problem with Ajax.Request. I find > > > that it basically just loops round and round and round forever, and > > > never finishes. > > > > > // uses ajax to attempt to connect to a database. Inserts either yes > > > or no into error div > > > function form_db(server, username, password, name) > > > { > > > //alert(''hi''); > > > new Ajax.Request(''ajax_handler.php'', > > > { > > > method:''get'', > > > onSuccess: function(transport){ > > > var response = transport.responseText || "no response text"; > > > alert("Success! \n\n" + response); > > > }, > > > onFailure: function(){ alert(''Something went wrong...'') } > > > }); > > > > > } > > > > > This just constantly alerts "success + " the correct response from > > > php, but it alerts again and again and again and never stops! If I > > > comment out the prototype code and uncomment alert(''hi''), that only > > > alerts once so it must be a problem with the prototype usage. Could > > > someone explain to me how to get it to just do one request then > > > finish? > > > > > Thanks, > > > Simon > > > > -- > > Science answers questions; philosophy questions answers. > > >-- Science answers questions; philosophy questions answers. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Thanks to all, think I fixed this. On Jun 4, 6:13 pm, "Frederick Polgardy" <f...-SMQUYeM9IBBWk0Htik3J/w@public.gmane.org> wrote:> You can call .stop() on your periodical updater object once you''ve created > it. Just have to save it away.... > > var updater = new Ajax.PeriodicalUpdater(...); > if (someCondition) updater.stop(); > > Different issue - what the OP posted doesn''t involve a PeriodicalUpdater. > > On Wed, Jun 4, 2008 at 12:07 PM, voracious_reader <swati...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: > > > > > > > I have the same issue. I''m using Ajax.PeriodicalUpdater. I want to > > stop making calls based on condition. How do I do it? > > > On Jun 4, 8:42 am, "Frederick Polgardy" <f...-SMQUYeM9IBBWk0Htik3J/w@public.gmane.org> wrote: > > > I can''t think of any reason why you''re seeing this. Can you post a > > complete > > > page that demonstrates this? You might be calling form_db() over and > > over > > > and not realizing it. Hard to tell. > > > > On Wed, Jun 4, 2008 at 4:37 AM, sheps-ii <simonrsheph...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> > > > wrote: > > > > > Hi, > > > > I''m new to prototype and am having a problem with Ajax.Request. I find > > > > that it basically just loops round and round and round forever, and > > > > never finishes. > > > > > // uses ajax to attempt to connect to a database. Inserts either yes > > > > or no into error div > > > > function form_db(server, username, password, name) > > > > { > > > > //alert(''hi''); > > > > new Ajax.Request(''ajax_handler.php'', > > > > { > > > > method:''get'', > > > > onSuccess: function(transport){ > > > > var response = transport.responseText || "no response text"; > > > > alert("Success! \n\n" + response); > > > > }, > > > > onFailure: function(){ alert(''Something went wrong...'') } > > > > }); > > > > > } > > > > > This just constantly alerts "success + " the correct response from > > > > php, but it alerts again and again and again and never stops! If I > > > > comment out the prototype code and uncomment alert(''hi''), that only > > > > alerts once so it must be a problem with the prototype usage. Could > > > > someone explain to me how to get it to just do one request then > > > > finish? > > > > > Thanks, > > > > Simon > > > > -- > > > Science answers questions; philosophy questions answers. > > -- > Science answers questions; philosophy questions answers.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
voracious_reader
2008-Jun-05 22:50 UTC
Re: Ajax.Request - how to stop it going in constant loop?!
Can you tell me how. Thanks, On Jun 4, 10:28 am, sheps-ii <simonrsheph...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> Thanks to all, think I fixed this. > > On Jun 4, 6:13 pm, "Frederick Polgardy" <f...-SMQUYeM9IBBWk0Htik3J/w@public.gmane.org> wrote: > > > You can call .stop() on your periodical updater object once you''ve created > > it. Just have to save it away.... > > > var updater = new Ajax.PeriodicalUpdater(...); > > if (someCondition) updater.stop(); > > > Different issue - what the OP posted doesn''t involve a PeriodicalUpdater. > > > On Wed, Jun 4, 2008 at 12:07 PM, voracious_reader <swati...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > > wrote: > > > > I have the same issue. I''m using Ajax.PeriodicalUpdater. I want to > > > stop making calls based on condition. How do I do it? > > > > On Jun 4, 8:42 am, "Frederick Polgardy" <f...-SMQUYeM9IBBWk0Htik3J/w@public.gmane.org> wrote: > > > > I can''t think of any reason why you''re seeing this. Can you post a > > > complete > > > > page that demonstrates this? You might be calling form_db() over and > > > over > > > > and not realizing it. Hard to tell. > > > > > On Wed, Jun 4, 2008 at 4:37 AM, sheps-ii <simonrsheph...@googlemail.com> > > > > wrote: > > > > > > Hi, > > > > > I''m new to prototype and am having a problem with Ajax.Request. I find > > > > > that it basically just loops round and round and round forever, and > > > > > never finishes. > > > > > > // uses ajax to attempt to connect to a database. Inserts either yes > > > > > or no into error div > > > > > function form_db(server, username, password, name) > > > > > { > > > > > //alert(''hi''); > > > > > new Ajax.Request(''ajax_handler.php'', > > > > > { > > > > > method:''get'', > > > > > onSuccess: function(transport){ > > > > > var response = transport.responseText || "no response text"; > > > > > alert("Success! \n\n" + response); > > > > > }, > > > > > onFailure: function(){ alert(''Something went wrong...'') } > > > > > }); > > > > > > } > > > > > > This just constantly alerts "success + " the correct response from > > > > > php, but it alerts again and again and again and never stops! If I > > > > > comment out the prototype code and uncomment alert(''hi''), that only > > > > > alerts once so it must be a problem with the prototype usage. Could > > > > > someone explain to me how to get it to just do one request then > > > > > finish? > > > > > > Thanks, > > > > > Simon > > > > > -- > > > > Science answers questions; philosophy questions answers. > > > -- > > Science answers questions; philosophy questions answers.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Frederick Polgardy
2008-Jun-06 01:49 UTC
Re: Ajax.Request - how to stop it going in constant loop?!
Can you post a little bit of your code that uses the PeriodicalUpdater, and where you''re executing the logic where you want it to stop? It''s hard to say much more than what I posted without being able to see how you''re using it. On Thu, Jun 5, 2008 at 5:50 PM, voracious_reader <swati.rk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Can you tell me how. Thanks, > > On Jun 4, 10:28 am, sheps-ii <simonrsheph...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: > > Thanks to all, think I fixed this. > > > > On Jun 4, 6:13 pm, "Frederick Polgardy" <f...-SMQUYeM9IBBWk0Htik3J/w@public.gmane.org> wrote: > > > > > You can call .stop() on your periodical updater object once you''ve > created > > > it. Just have to save it away.... > > > > > var updater = new Ajax.PeriodicalUpdater(...); > > > if (someCondition) updater.stop(); > > > > > Different issue - what the OP posted doesn''t involve a > PeriodicalUpdater. > > > > > On Wed, Jun 4, 2008 at 12:07 PM, voracious_reader <swati...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > > > wrote: > > > > > > I have the same issue. I''m using Ajax.PeriodicalUpdater. I want to > > > > stop making calls based on condition. How do I do it?-- Science answers questions; philosophy questions answers. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---