ok, I have looked for the past two days for an example of how to get the stop method to work. I have yet to find a coheasive example my code is strate formard. I have three sections to my site. The first is the about section, second is a ticker section and third is historical section. So when the user clicks on the ticker section this needs to update every 15 seconds. The other two pages don''t need to update. The problem is when the user clicks on the about or historical page I see the PeriodicalUpdater still runnning in the background on firebug. My code /** * makePeriodicalUpdater function is a shortcut to the prototype Ajax.Updater object. * @param div the div that you want the response to be written into. * @param url the location to send the request to. * @param method post or get. * @param method pars any parameters that need to be passed. These should be in QueryString format. * @param eval boolean that decides whether or not scripts should be evaluated. **/ PeriodicalUpdater: function(localDiv, localUrl, localMethod, localPars, localEval) { //javascript debug if(siteDebug == 4) { alert(''localUrl:'' + localUrl); alert(''localDiv:'' + localDiv); alert(''localMethod:'' + localMethod); alert(''localPars:'' + localPars); alert(''localEval:'' + localEval); } //end javascript debug var objName = ''obj''+localDiv; alert(objName); objName = new Ajax.PeriodicalUpdater( localDiv, localUrl, { frequency : 15, decay: 1.1, method: localMethod, parameters: localPars, evalScripts:localEval, //onCreate:this.PeriodicalUpdaterLoading.bind(this), onComplete:this.PeriodicalUpdaterLoadingComplete(localDiv) //onSuccess:this.PeriodicalUpdaterSuccess.bind(this), //onFailure:this.PeriodicalUpdaterFailure.bind(this) }); //alert(''PeriodicalUpdater:''+localDiv); // Make sure the div is displayed. //$(localDiv).style.display=''block''; return true; //javascript debug if(siteDebug == 4) { alert(''Getting the Menu Through the menu ajax updater''); } //end javascript debug }, --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
ok, I have looked for the past two days for an example of how to get the stop method to work. I have yet to find a coheasive example my code is strate formard. I have three sections to my site. The first is the about section, second is a ticker section and third is historical section. So when the user clicks on the ticker section this needs to update every 15 seconds. The other two pages don''t need to update. The problem is when the user clicks on the about or historical page I see the PeriodicalUpdater still runnning in the background on firebug. My code /** * makePeriodicalUpdater function is a shortcut to the prototype Ajax.Updater object. * @param div the div that you want the response to be written into. * @param url the location to send the request to. * @param method post or get. * @param method pars any parameters that need to be passed. These should be in QueryString format. * @param eval boolean that decides whether or not scripts should be evaluated. **/ PeriodicalUpdater: function(localDiv, localUrl, localMethod, localPars, localEval) { objTick = new Ajax.PeriodicalUpdater( localDiv, localUrl, { frequency : 15, decay: 1.1, method: localMethod, parameters: localPars, evalScripts:localEval }); //turns the local div on $(localDiv).style.display=''block''; return true; }, Then later in the code if the use clicks on the about link I have if(request==''about'') { ... code that hides the divs that are currently displayed ...... this.objTick.stop(); .... Then more code to display the about page which goes to a just Ajax.Updater class. ..... } --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
You can always just use the regular updater and use setTimeout to call itself after it completes. Then just put some logic around the setTimeout. On Mar 26, 1:10 pm, seran128 <jeff.webdevelo...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> ok, I have looked for the past two days for an example of how to get > the stop method to work. I have yet to find a coheasive example my > code is strate formard. I have three sections to my site. The first is > the about section, second is a ticker section and third is historical > section. So when the user clicks on the ticker section this needs to > update every 15 seconds. The other two pages don''t need to update. The > problem is when the user clicks on the about or historical page I see > the PeriodicalUpdater still runnning in the background on firebug. > My code > > /** > * makePeriodicalUpdater function is a shortcut to the prototype > Ajax.Updater object. > * @param div the div that you want the response to be written into. > * @param url the location to send the request to. > * @param method post or get. > * @param method pars any parameters that need to be passed. These > should be in QueryString format. > * @param eval boolean that decides whether or not scripts should be > evaluated. > **/ > PeriodicalUpdater: function(localDiv, localUrl, localMethod, > localPars, localEval) > { > > objTick = new Ajax.PeriodicalUpdater( > localDiv, > localUrl, > { > frequency : 15, > decay: 1.1, > method: localMethod, > parameters: localPars, > evalScripts:localEval > > }); > //turns the local div on > $(localDiv).style.display=''block''; > return true; > > }, > > Then later in the code if the use clicks on the about link I have > > if(request==''about'') > { > ... > code that hides the divs that are currently displayed > ...... > > this.objTick.stop(); > .... > Then more code to display the about page > which goes to a just Ajax.Updater class. > ..... > > }--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Isn''t the problem that you''re assigning the periodical updater to a global variable objTick and then later you''re trying to access the same object via this.objTick?> objTick = new Ajax.PeriodicalUpdater( > ... > this.objTick.stop();The Ajax.PeriodicalUpdater object most certainly supports the stop method, I use it all the time and have never had a problem. -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 -~----------~----~----~----~------~----~------~--~---
I tried just objTick.stop(); but that does not work either. On Mar 26, 2:21 pm, "Justin Perkins" <justinperk...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Isn''t the problem that you''re assigning the periodical updater to a > global variable objTick and then later you''re trying to access the > same object via this.objTick? > > > objTick = new Ajax.PeriodicalUpdater( > > ... > > this.objTick.stop(); > > The Ajax.PeriodicalUpdater object most certainly supports the stop > method, I use it all the time and have never had a problem. > > -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 -~----------~----~----~----~------~----~------~--~---