Hi I am a real beginner with prototype so sorry this is a real beginners question! I have a page I want to update dynamically when a link is clicked, and different content (supplied from a php script) according to which link. I was thinking to pass the id of the link to the script and use Ajax.Updater. So far I have this but it doesn''t quite work: function doSwap(page) { new Ajax.Updater(''fruit'', ''gimme.php'', { method: ''get'', parameters: page=$ }); return false; } <div id="fruit"> <p>Content</p> </div> <a href="#" id="toggle1" onclick="doSwap(); return false;">toggle1 baby</a> <a href="#" id="toggle2" onclick="doSwap(); return false;">toggle2 baby</a> <a href="#" id="toggle3" onclick="doSwap(); return false;">toggle3 baby</a> <a href="#" id="toggle4" onclick="doSwap(); return false;">toggle4 baby</a> --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Your links are calling doSwap() with no parameters, so page will be undefined. Also, your syntax of parameters: page=$ was... well, not sure what you were trying to do there. See edits below. I assume you want to pass the ID as the value of the page param? I''m passing this as a parameter to doSwap, which will be a reference to the <a> element which was clicked. Then the function extracts the link ID to form the parameters string. And your function doesn''t need to return false if your onclick returns false. Alternatively, you could say onclick="return doSwap(link)" and put the return false; back in. -Fred On Wed, Jun 18, 2008 at 9:08 PM, McBlaue <emrys.hughes-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> function doSwap(link) { > new Ajax.Updater(''fruit'', ''gimme.php'', { > method: ''get'', parameters: ''page='' + link.id }); > } > > <div id="fruit"> > > <p>Content</p> > > </div> > > <a href="#" id="toggle1" onclick="doSwap(this); return false;">toggle1 > baby</a> > <a href="#" id="toggle2" onclick="doSwap(this); return false;">toggle2 > baby</a> > <a href="#" id="toggle3" onclick="doSwap(this); return false;">toggle3 > baby</a> > <a href="#" id="toggle4" onclick="doSwap(this); return false;">toggle4 > baby</a>-- Science answers questions; philosophy questions answers. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Sorry to be a pain in the arse guys, but AJAX.Updater doesn''t seem to work at all on IE/Opera. Please see another thread on AJAX.Updater and IE. Luis Pabón --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Can you be more specific? I worked on a major project for the last 9 months that made heavy use of Ajax.Updater in IE. -Fred On Thu, Jun 19, 2008 at 2:37 AM, Luis Pabón <copong-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Sorry to be a pain in the arse guys, but AJAX.Updater doesn''t seem to work > at all on IE/Opera. Please see another thread on AJAX.Updater and IE. > > Luis Pabón-- Science answers questions; philosophy questions answers. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hi, On Jun 19, 8:37 am, "Luis Pabón" <cop...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Sorry to be a pain in the arse guys, but AJAX.Updater doesn''t seem to work > at all on IE/Opera. Please see another thread on AJAX.Updater and IE.Pull the other one, it''s got bells on. Of course it works in IE and Opera. Just because some user is having some problem somewhere (which is almost certainly in his code, not the library), there''s no need to cross-pollute threads with statements like "it doesn''t work in IE/ Opera". That''s not useful, accurate, or appropriate. Even if the problem he''s running into turns out to be a bug in the library in some specific situation (which is possible, just unlikely), that''s a far cry from "it doesn''t work." -- T.J. Crowder tj / crowder software / com --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Please see my last emails with a test case in here: http://groups.google.com/group/rubyonrails-spinoffs/browse_thread/thread/7135d61e6c7caaf5/b095aed783686fb2?lnk=gst&q=updater#b095aed783686fb2 I may be doing something inherently wrong on te test case, but looks straightforward enough to me. Cheers, Luis --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Luis, So discuss it over there. See above about cross-polluting. The lack of replies in that thread is not a reason to hijack other threads. -- T.J. Crowder tj / crowder software / com On Jun 19, 12:36 pm, "Luis Pabón" <cop...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Please see my last emails with a test case in here:http://groups.google.com/group/rubyonrails-spinoffs/browse_thread/thr... > > I may be doing something inherently wrong on te test case, but looks > straightforward enough to me. > > Cheers, > Luis--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Fair enough. It wasn''t my intention to hijack this thread, I thought it was relevant mentioning that updater may not work on ie since this user is trying to use it (although incorrectly as far as I can see). Luis Pabón 2008/6/19 T.J. Crowder <tj-MUGVhKWuB3Yd9SLi6J12IkEOCMrvLtNR@public.gmane.org>:> > Luis, > > So discuss it over there. See above about cross-polluting. The lack > of replies in that thread is not a reason to hijack other threads. > -- > T.J. Crowder > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Well, FWIW for anyone still lurking on this thread, Fred''s corrected code works fine on IE6, Opera 9, FF3, and Safari 3.1 (on Windows XP). -- T.J. On Jun 19, 2:01 pm, "Luis Pabón" <cop...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Fair enough. It wasn''t my intention to hijack this thread, I thought it was > relevant mentioning that updater may not work on ie since this user is > trying to use it (although incorrectly as far as I can see). > > Luis Pabón > > 2008/6/19 T.J. Crowder <t...-MUGVhKWuB3Yd9SLi6J12IkEOCMrvLtNR@public.gmane.org>: > > > > > Luis, > > > So discuss it over there. See above about cross-polluting. The lack > > of replies in that thread is not a reason to hijack other threads. > > -- > > T.J. Crowder > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---