Well, first of all, clean up the code and don't use inline event
handlers, logic is much more difficult to add there :)
I'd do something like this:

document.observe("dom:loaded", function() {
  var updater;
  $$(".navigation_link").invoke("observe", "click", function(event) {
    event.stop();
    if (updater) updater.stop();
    updater = new Ajax.PeriodicalUpdater(this.readAttribute("href"), {
method: "get", ... });
  });
});

And change the html to something like

<a href="index.php?page=1" class="navigation_link">Home</a>
<a href="index.php?page=2" class="navigation_link">Articles</a>

This way, if javascript if disabled, the link will be followed anyway
and your users won't be stuck in the current page :)

Best,
-Nicolas

On Dec 30, 2007 2:41 PM, Geoff <[EMAIL PROTECTED]> wrote:
>
> So, I've been working on a page to update previous calls with new
> calls when click on certain lnks.
> For example:
>
> <a href="onClick='new Ajax.PeriodicalUpdater{method: get, index.php?
> page=1, frequency: 300, decay 300 }'>Home</a>
> <a href="onClick='new Ajax.PeriodicalUpdater{method: get, index.php?
> page=2, frequency: 300, decay 300 }'>Articles</a>
>
> I click on the Home link, it updates fine BUT when I click on the
> Articles link, that info is pulled as well in addition to the info
> that was pulled when clicking the Home link too. So, it's rotating
> between both.
>
> What could I do to stop the first ajax call when I click on a second
> click to make a new ajax call? Any help is greatly appreciated.
> >
>

--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to