HI, I''m experiencing some random behavior from prototype''s onsuccess Ajax.Request handler. Whenever I do an Ajax.Request, my onSuccess code isn''t being executed. However, this only occurs when I''m using a onLoading. If I remove onloading, I dont'' have any ajax problems. Has anybody else experienced this behavior before? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
David Dashifen Kees
2007-Apr-18 20:55 UTC
Re: prototype Ajax.Request onSuccess code not executing
What does your onLoading action do? Can you post your code. - Dash - eggie5 wrote:> HI, > > I''m experiencing some random behavior from prototype''s onsuccess > Ajax.Request handler. > > Whenever I do an Ajax.Request, my onSuccess code isn''t being executed. > However, this only occurs when I''m using a onLoading. If I remove > onloading, I dont'' have any ajax problems. > > Has anybody else experienced this behavior before? > > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
It''s nothing special... var c=$(''carrier''); new Ajax.Request(''subscribe.aspx?action=databind.carriers'', { method:''post'', asynchronous:true, onSuccess:function(resp) { console.log(resp.responseText); c.innerHTML=''''; var data = eval(''('' + resp.responseText + '')''); var label=document.createElement(''label''); label.setAttribute(''for'',''s_carrier''); label.appendChild(document.createTextNode(''Carrier: '')); var select=document.createElement(''select''); select.className=''validate-selection''; select.id=''s_carrier''; select.name=''carrier''; select.title=''Please select your carrier/service provider''; //Pad with blank item var option=document.createElement(''option''); // should this be some hint text? select.appendChild(option); for(i=0;i<data.carriers.length;i++) { var option=document.createElement(''option''); option.value=data.carriers[i].CarrierID;//I should set this to the carrierID option.appendChild(document.createTextNode(data.carriers[i].Name)); select.appendChild(option); } label.appendChild(select); c.appendChild(label); console.log(''end of carriers''); // Event.observe(''s_carrier'', ''change'', BuildModelGrid); Event.observe(''s_carrier'', ''change'', DatabindManufacturers); }, onLoading:function(resp) { c.innerHTML=''<img src="assets/css/mediacomm/images/ loading.gif" /> Loading...''; }, onFailure: function(resp) { c.innerHTML=resp.responseText; } }); On Apr 18, 1:55 pm, David Dashifen Kees <dashi...-NT0ononE2K1Wk0Htik3J/w@public.gmane.org> wrote:> What does your onLoading action do? Can you post your code. > - Dash - > > eggie5 wrote: > > HI, > > > I''m experiencing some random behavior from prototype''s onsuccess > > Ajax.Request handler. > > > Whenever I do an Ajax.Request, my onSuccess code isn''t being executed. > > However, this only occurs when I''m using a onLoading. If I remove > > onloading, I dont'' have any ajax problems. > > > Has anybody else experienced this behavior before?--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
David Dashifen Kees
2007-Apr-19 01:50 UTC
Re: prototype Ajax.Request onSuccess code not executing
I didn''t look too carefully, but I notice that you''re trying to mix get and post data. By attaching a query string information (the ?action=databind.carries portion of your url) but also adding the post method explicitly in the parameters to the Ajax.Request object you might be causing some problems there. Also, since the post method and a true asynchronous flag are default, you don''t really need to specify them in your parameters. To be honest, other than that I don''t see anything that''s causing the problem, sorry. -- Dash -- eggie5 wrote:> It''s nothing special... > > var c=$(''carrier''); > > new Ajax.Request(''subscribe.aspx?action=databind.carriers'', > { > > method:''post'', > asynchronous:true, > > onSuccess:function(resp) > { > console.log(resp.responseText); > c.innerHTML=''''; > var data = eval(''('' + resp.responseText + '')''); > > var label=document.createElement(''label''); > label.setAttribute(''for'',''s_carrier''); > label.appendChild(document.createTextNode(''Carrier: > '')); > var select=document.createElement(''select''); > select.className=''validate-selection''; > select.id=''s_carrier''; > select.name=''carrier''; > select.title=''Please select your carrier/service > provider''; > > //Pad with blank item > var option=document.createElement(''option''); // > should this be some hint text? > select.appendChild(option); > > for(i=0;i<data.carriers.length;i++) > { > var option=document.createElement(''option''); > option.value=data.carriers[i].CarrierID;//I should > set this to the carrierID > > option.appendChild(document.createTextNode(data.carriers[i].Name)); > > > select.appendChild(option); > } > > label.appendChild(select); > > c.appendChild(label); > console.log(''end of carriers''); > // Event.observe(''s_carrier'', ''change'', > BuildModelGrid); > Event.observe(''s_carrier'', ''change'', > DatabindManufacturers); > > > }, > onLoading:function(resp) > { > c.innerHTML=''<img src="assets/css/mediacomm/images/ > loading.gif" /> Loading...''; > }, > onFailure: function(resp) > { > c.innerHTML=resp.responseText; > } > }); > > On Apr 18, 1:55 pm, David Dashifen Kees <dashi...-NT0ononE2K1Wk0Htik3J/w@public.gmane.org> wrote: > >> What does your onLoading action do? Can you post your code. >> - Dash - >> >> eggie5 wrote: >> >>> HI, >>> >>> I''m experiencing some random behavior from prototype''s onsuccess >>> Ajax.Request handler. >>> >>> Whenever I do an Ajax.Request, my onSuccess code isn''t being executed. >>> However, this only occurs when I''m using a onLoading. If I remove >>> onloading, I dont'' have any ajax problems. >>> >>> Has anybody else experienced this behavior before? >>> > > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
new Ajax.Request(''subscribe.aspx?action=databind.carriers'', { method:''post'', asynchronous:true, onSuccess:function(resp) { alert("onSuccess"); .... }, onLoading:function(resp) { alert("onLoading"); .... }, onFailure: function(resp) { alert("onFailure"); .... } }); --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Christophe Porteneuve
2007-Apr-19 06:06 UTC
Re: prototype Ajax.Request onSuccess code not executing
Maybe you have an exception being throw in your onLoading for some reason. You won''t see it unless you bind onException, either locally or at the global level with Ajax.Responders. If there''s one it''s likely to break your A.R flow. -- Christophe Porteneuve a.k.a. TDD "[They] did not know it was impossible, so they did it." --Mark Twain Email: tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
This is a surprise for me. You''re not supposed to use query string with post requests? On Apr 18, 6:50 pm, David Dashifen Kees <dashi...-NT0ononE2K1Wk0Htik3J/w@public.gmane.org> wrote:> I didn''t look too carefully, but I notice that you''re trying to mix get > and post data. By attaching a query string information (the > ?action=databind.carries portion of your url) but also adding the post > method explicitly in the parameters to the Ajax.Request object you might > be causing some problems there. Also, since the post method and a true > asynchronous flag are default, you don''t really need to specify them in > your parameters. To be honest, other than that I don''t see anything > that''s causing the problem, sorry. > > -- Dash -- > > eggie5 wrote: > > It''s nothing special... > > > var c=$(''carrier''); > > > new Ajax.Request(''subscribe.aspx?action=databind.carriers'', > > { > > > method:''post'', > > asynchronous:true, > > > onSuccess:function(resp) > > { > > console.log(resp.responseText); > > c.innerHTML=''''; > > var data = eval(''('' + resp.responseText + '')''); > > > var label=document.createElement(''label''); > > label.setAttribute(''for'',''s_carrier''); > > label.appendChild(document.createTextNode(''Carrier: > > '')); > > var select=document.createElement(''select''); > > select.className=''validate-selection''; > > select.id=''s_carrier''; > > select.name=''carrier''; > > select.title=''Please select your carrier/service > > provider''; > > > //Pad with blank item > > var option=document.createElement(''option''); // > > should this be some hint text? > > select.appendChild(option); > > > for(i=0;i<data.carriers.length;i++) > > { > > var option=document.createElement(''option''); > > option.value=data.carriers[i].CarrierID;//I should > > set this to the carrierID > > > option.appendChild(document.createTextNode(data.carriers[i].Name)); > > > select.appendChild(option); > > } > > > label.appendChild(select); > > > c.appendChild(label); > > console.log(''end of carriers''); > > // Event.observe(''s_carrier'', ''change'', > > BuildModelGrid); > > Event.observe(''s_carrier'', ''change'', > > DatabindManufacturers); > > > }, > > onLoading:function(resp) > > { > > c.innerHTML=''<img src="assets/css/mediacomm/images/ > > loading.gif" /> Loading...''; > > }, > > onFailure: function(resp) > > { > > c.innerHTML=resp.responseText; > > } > > }); > > > On Apr 18, 1:55 pm, David Dashifen Kees <dashi...-NT0ononE2K1Wk0Htik3J/w@public.gmane.org> wrote: > > >> What does your onLoading action do? Can you post your code. > >> - Dash - > > >> eggie5 wrote: > > >>> HI, > > >>> I''m experiencing some random behavior from prototype''s onsuccess > >>> Ajax.Request handler. > > >>> Whenever I do an Ajax.Request, my onSuccess code isn''t being executed. > >>> However, this only occurs when I''m using a onLoading. If I remove > >>> onloading, I dont'' have any ajax problems. > > >>> Has anybody else experienced this behavior before?--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Christophe Porteneuve
2007-Apr-23 07:27 UTC
Re: prototype Ajax.Request onSuccess code not executing
eggie5 a écrit :> This is a surprise for me. You''re not supposed to use query string > with post requests?Not on the URI, no. I don''t believe it''s said so in the spec [1], but it''s certainly considered as bad practice, as many server layers blend POST- and GET-originating parameters together (e.g. JavaEE), and this could lead to unintentional overwrites. [1] http://tools.ietf.org/html/rfc2616 -- Christophe Porteneuve a.k.a. TDD "[They] did not know it was impossible, so they did it." --Mark Twain Email: tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Slap myself on the hand. Thanks for the heads up! On Apr 23, 12:27 am, Christophe Porteneuve <t...-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org> wrote:> eggie5 a écrit : > > > This is a surprise for me. You''re not supposed to use query string > > with post requests? > > Not on the URI, no. I don''t believe it''s said so in the spec [1], but > it''s certainly considered as bad practice, as many server layers blend > POST- and GET-originating parameters together (e.g. JavaEE), and this > could lead to unintentional overwrites. > > [1]http://tools.ietf.org/html/rfc2616 > > -- > Christophe Porteneuve a.k.a. TDD > "[They] did not know it was impossible, so they did it." --Mark Twain > Email: t...-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---