Hello, Here''s a simple example: <div id="container">No records found.</div> new Ajax.Updater({success: ''container''}, ''http://...'', {method:''get'', onComplete: myCallback}); When the request fails, #container content is left as is - that''s fine. When it succeeds, #container content is replaced with the response text - that''s fine as well. However, if the request is cancelled (ESC key is pressed, for example), #container content is cleared completely. What is the reason behind this? Any way to prevent this behavior? I would certainly prefer #container left untouched in this case. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Taking a glance at Ajax.Options (http://prototypejs.org/api/ajax/ options)... You may try the "onXYZ" callback option; in this case, on0 (zero). Cause, AFAIK, when the user hits ESC during a request, readyState = 4 and status = 0. new Ajax.Updater({success: ''container''}, ''http://...'', { method:''get'', onComplete: myCallback, on0: Prototype.emptyFunction }); The idea is only theory; I haven''t used it, myself. So, let me know if you have any luck. - Jon L. On Apr 4, 4:38 am, Ree <rytis.daugir...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello, > > Here''s a simple example: > > <div id="container">No records found.</div> > > new Ajax.Updater({success: ''container''}, ''http://...'', {method:''get'', > onComplete: myCallback}); > > When the request fails, #container content is left as is - that''s > fine. When it succeeds, #container content is replaced with the > response text - that''s fine as well. However, if the request is > cancelled (ESC key is pressed, for example), #container content is > cleared completely. What is the reason behind this? Any way to prevent > this behavior? I would certainly prefer #container left untouched in > this case.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Unfortunately, that didn''t help... I guess I''ll have to think of something else to try. On Apr 4, 8:03 pm, "Jon L." <jonllm...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Taking a glance at Ajax.Options (http://prototypejs.org/api/ajax/ > options)... > > You may try the "onXYZ" callback option; in this case, on0 (zero). > Cause, AFAIK, when the user hits ESC during a request, readyState = 4 > and status = 0. > > new Ajax.Updater({success: ''container''}, ''http://...'', { > method:''get'', > onComplete: myCallback, > on0: Prototype.emptyFunction > > }); > > The idea is only theory; I haven''t used it, myself. > So, let me know if you have any luck. > > - Jon L. > > On Apr 4, 4:38 am, Ree <rytis.daugir...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hello, > > > Here''s a simple example: > > > <div id="container">No records found.</div> > > > new Ajax.Updater({success: ''container''}, ''http://...'', {method:''get'', > > onComplete: myCallback}); > > > When the request fails, #container content is left as is - that''s > > fine. When it succeeds, #container content is replaced with the > > response text - that''s fine as well. However, if the request is > > cancelled (ESC key is pressed, for example), #container content is > > cleared completely. What is the reason behind this? Any way to prevent > > this behavior? I would certainly prefer #container left untouched in > > this case.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---