julieknoll-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Apr-23 15:04 UTC
Canceling ajax request
Hello, I am trying cancel an ajax request when a user clicks a close icon. This is what I am putting in my ajax request object: onLoading: function(transport) { Event.observe(''stop_load'',''click'',transport.abort) }, But it doesn''t do anything at all, it doesn''t seem like the event is being captured. I''ve tried using function(e) {alert ''clicked''} instead of the abort call, but that never gets called either. The code for the close icon is <img src="images/close.gif" border="0" id="stop_load"> What am I doing wrong? Thanks for the help, Julie --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I know you can stop a PeriodicUpdater. var obj_AjaxProgress = new Ajax.PeriodicalUpdater ( ''progressID'', ''URL'', { method : ''get'', frequency : 1, decay : 1.5 }); Now, you can use ... obj_AjaxProgess.Stop() anywhere where you have access to obj_AjaxProgress. But I can''t see from the dox how to abort a current AJAX request. On 23/04/07, julieknoll-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <julieknoll-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hello, > > I am trying cancel an ajax request when a user clicks a close icon. > This is what I am putting in my ajax request object: > > onLoading: function(transport) { > Event.observe(''stop_load'',''click'',transport.abort) > }, > > > But it doesn''t do anything at all, it doesn''t seem like the event is > being captured. I''ve tried using function(e) {alert ''clicked''} instead > of the abort call, but that never gets called either. > > The code for the close icon is <img src="images/close.gif" border="0" > id="stop_load"> > > What am I doing wrong? > > Thanks for the help, > Julie > > > > >-- ----- Richard Quadling Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731 "Standing on the shoulders of some very clever giants!" --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Try loading it into a variable, and then calling dispose() on it when you don''t want it to be around any more (totally untested): var myProgress = new Ajax.Whatever(); ... myProgress.dispose(); Walter On Apr 23, 2007, at 11:41 AM, Richard Quadling wrote:> > I know you can stop a PeriodicUpdater. > > var obj_AjaxProgress = new Ajax.PeriodicalUpdater > ( > ''progressID'', > ''URL'', > { > method : ''get'', > frequency : 1, > decay : 1.5 > }); > > Now, you can use ... > > obj_AjaxProgess.Stop() anywhere where you have access to > obj_AjaxProgress. > > But I can''t see from the dox how to abort a current AJAX request. > > On 23/04/07, julieknoll-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <julieknoll-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >> Hello, >> >> I am trying cancel an ajax request when a user clicks a close icon. >> This is what I am putting in my ajax request object: >> >> onLoading: function(transport) { >> Event.observe(''stop_load'',''click'',transport.abort) >> }, >> >> >> But it doesn''t do anything at all, it doesn''t seem like the event is >> being captured. I''ve tried using function(e) {alert ''clicked''} instead >> of the abort call, but that never gets called either. >> >> The code for the close icon is <img src="images/close.gif" border="0" >> id="stop_load"> >> >> What am I doing wrong? >> >> Thanks for the help, >> Julie >> >> >>> >> > > > -- > ----- > Richard Quadling > Zend Certified Engineer : > http://zend.com/zce.php?c=ZEND002498&r=213474731 > "Standing on the shoulders of some very clever giants!" > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---