Hi... I have an rjs file to replace a div using ajax call. page["#{params[:id]}parents"].replace :partial => ''cipart/expanded_item'', :locals => { :expand_items => CiRelation.find_all_by_ci_id(params[:id])} "#{params[:id]}parents" is the name of the div to be replaced. In some cases depending on a condition, this div does not exist. Then in the rjs file I have to check for the existence of this div. How can I do this? Please help. Thanks Suneeta -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
if page["#{params[:id]}parents"] On Tue, May 20, 2008 at 4:52 PM, Suneeta Km < rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Hi... > > I have an rjs file to replace a div using ajax call. > > page["#{params[:id]}parents"].replace :partial => > ''cipart/expanded_item'', :locals => { :expand_items => > CiRelation.find_all_by_ci_id(params[:id])} > > "#{params[:id]}parents" is the name of the div to be replaced. > > In some cases depending on a condition, this div does not exist. Then > in the rjs file I have to check for the existence of this div. How can I > do this? > > Please help. > > Thanks > Suneeta > -- > Posted via http://www.ruby-forum.com/. > > > >-- Appreciated my help? Reccommend me on Working With Rails http://workingwithrails.com/person/11030-ryan-bigg --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ryan Bigg wrote:> if page["#{params[:id]}parents"] > > On Tue, May 20, 2008 at 4:52 PM, Suneeta Km < > rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: > >> >> >> > >> > > > -- > Appreciated my help? > Reccommend me on Working With Rails > http://workingwithrails.com/person/11030-ryan-biggHi Thanks for replying. I tried this if condition. But an rjs error message is displayed. ''Type error: $("15parents") has no properties'' 15parents is the name of the div. 15 is obtained by evaluating params[:id] Please help. Suneeta -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Try suffixing it with a call to .nil? On Tue, May 20, 2008 at 5:13 PM, Suneeta Km < rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Ryan Bigg wrote: > > if page["#{params[:id]}parents"] > > > > On Tue, May 20, 2008 at 4:52 PM, Suneeta Km < > > rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: > > > >> > >> > >> > > >> > > > > > > -- > > Appreciated my help? > > Reccommend me on Working With Rails > > http://workingwithrails.com/person/11030-ryan-bigg > > > Hi > Thanks for replying. > > I tried this if condition. But an rjs error message is displayed. > ''Type error: $("15parents") has no properties'' > 15parents is the name of the div. 15 is obtained by evaluating > params[:id] > Please help. > > Suneeta > -- > Posted via http://www.ruby-forum.com/. > > > >-- Appreciated my help? Reccommend me on Working With Rails http://workingwithrails.com/person/11030-ryan-bigg --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 20 May 2008, at 08:44, Ryan Bigg (Radar) wrote:> Try suffixing it with a call to .nil? >That fundamentally cannot work. that if is a ruby if (ie evaluated server side), but the condition is a client side one (whether a certain element is present). what does work is page << "if $(''some_id''){" #do some other stuff page << "}" There is rails plugin that helps with this http://rubyforge.org/projects/js-if-blocks/ Bear in mind that the partials are still rendered etc. no matter what. The only thing that is conditional is whether or not you use the chunk of html you''ve ferried over to the browser. Fred> On Tue, May 20, 2008 at 5:13 PM, Suneeta Km <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org > > wrote: > > Ryan Bigg wrote: > > if page["#{params[:id]}parents"] > > > > On Tue, May 20, 2008 at 4:52 PM, Suneeta Km < > > rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: > > > >> > >> > >> > > >> > > > > > > -- > > Appreciated my help? > > Reccommend me on Working With Rails > > http://workingwithrails.com/person/11030-ryan-bigg > > > Hi > Thanks for replying. > > I tried this if condition. But an rjs error message is displayed. > ''Type error: $("15parents") has no properties'' > 15parents is the name of the div. 15 is obtained by evaluating > params[:id] > Please help. > > Suneeta > -- > Posted via http://www.ruby-forum.com/. > > > > > > -- > Appreciated my help? > Reccommend me on Working With Rails > http://workingwithrails.com/person/11030-ryan-bigg > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ryan Bigg wrote:> Try suffixing it with a call to .nil? > > On Tue, May 20, 2008 at 5:13 PM, Suneeta Km < > rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: > >> >> >> >> > >> > > > -- > Appreciated my help? > Reccommend me on Working With Rails > http://workingwithrails.com/person/11030-ryan-biggI tried suffixing the if with .nil? But it didn''t work. Any other solution? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung wrote:> On 20 May 2008, at 08:44, Ryan Bigg (Radar) wrote: > >> Try suffixing it with a call to .nil? >> > That fundamentally cannot work. that if is a ruby if (ie evaluated > server side), but the condition is a client side one (whether a > certain element is present). > > what does work is > > page << "if $(''some_id''){" > #do some other stuff > page << "}" > > There is rails plugin that helps with this > http://rubyforge.org/projects/js-if-blocks/ > > Bear in mind that the partials are still rendered etc. no matter what. > The only thing that is conditional is whether or not you use the chunk > of html you''ve ferried over to the browser. > > FredCan I do this checking without using any plugin? I tried if $(''some_id''). I think the problem is, in my case the id of div is obtained by evaluating #{params[:id]} -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 20 May 2008, at 09:20, Suneeta Km wrote:> > Frederick Cheung wrote: >> On 20 May 2008, at 08:44, Ryan Bigg (Radar) wrote: >> >>> Try suffixing it with a call to .nil? >>> >> That fundamentally cannot work. that if is a ruby if (ie evaluated >> server side), but the condition is a client side one (whether a >> certain element is present). >> >> what does work is >> >> page << "if $(''some_id''){" >> #do some other stuff >> page << "}" >> >> There is rails plugin that helps with this >> http://rubyforge.org/projects/js-if-blocks/ >> >> Bear in mind that the partials are still rendered etc. no matter >> what. >> The only thing that is conditional is whether or not you use the >> chunk >> of html you''ve ferried over to the browser. >> >> Fred > > Can I do this checking without using any plugin? I tried if > $(''some_id''). I think the problem is, in my case the id of div is > obtained by evaluating #{params[:id]}You don''t need the plugin, you can just use what i posted above , it''s just a bit neeter with the plugin. if your div id is not static that is not a problem:>> page << "if $(''#{ "foo" + "bar" + "baz"}''){"Fred> > -- > Posted via http://www.ruby-forum.com/. > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung wrote:> On 20 May 2008, at 09:20, Suneeta Km wrote: > >>> what does work is >>> The only thing that is conditional is whether or not you use the >>> chunk >>> of html you''ve ferried over to the browser. >>> >>> Fred >> >> Can I do this checking without using any plugin? I tried if >> $(''some_id''). I think the problem is, in my case the id of div is >> obtained by evaluating #{params[:id]} > > You don''t need the plugin, you can just use what i posted above , it''s > just a bit neeter with the plugin. if your div id is not static that > is not a problem: >>> page << "if $(''#{ "foo" + "bar" + "baz"}''){" > > > FredI tried the following: page << "if $(''#{params[:id]}parents''){" page["#{params[:id]}parents"].replace :partial => ''cipart/expanded_item'', :locals => { :expand_items => CiRelation.find_all_by_ci_id(params[:id]), :relation => ''parents'', :ci_id=>params[:ci_id] } page << "}" If div exists, the partial file is executed. But it is not replaced and the result is not displayed. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 20 May 2008, at 09:50, Suneeta Km wrote:> > I tried the following: > page << "if $(''#{params[:id]}parents''){"> > page["#{params[:id]}parents"].replace :partial => > ''cipart/expanded_item'', :locals => { :expand_items => > CiRelation.find_all_by_ci_id(params[:id]), :relation => ''parents'', > :ci_id=>params[:ci_id] } > page << "}" > > If div exists, the partial file is executed. But it is not replaced > and > the result is not displayed.You''ve probably got the wrong div id. Poke around in firebug. Fred>--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung wrote:> On 20 May 2008, at 09:50, Suneeta Km wrote: >> >> I tried the following: >> page << "if $(''#{params[:id]}parents''){" > >> >> page["#{params[:id]}parents"].replace :partial => >> ''cipart/expanded_item'', :locals => { :expand_items => >> CiRelation.find_all_by_ci_id(params[:id]), :relation => ''parents'', >> :ci_id=>params[:ci_id] } >> page << "}" >> >> If div exists, the partial file is executed. But it is not replaced >> and >> the result is not displayed. > > You''ve probably got the wrong div id. Poke around in firebug. > > FredI printed the div id in an alert box and obtained the correct div. But still that div is not replaced. Don''t know why. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 20 May 2008, at 10:07, Suneeta Km wrote:> > Frederick Cheung wrote: >> On 20 May 2008, at 09:50, Suneeta Km wrote: >>> >>> I tried the following: >>> page << "if $(''#{params[:id]}parents''){" >> >>> >>> page["#{params[:id]}parents"].replace :partial => >>> ''cipart/expanded_item'', :locals => { :expand_items => >>> CiRelation.find_all_by_ci_id(params[:id]), :relation => ''parents'', >>> :ci_id=>params[:ci_id] } >>> page << "}" >>> >>> If div exists, the partial file is executed. But it is not replaced >>> and >>> the result is not displayed. >> >> You''ve probably got the wrong div id. Poke around in firebug. >> > I printed the div id in an alert box and obtained the correct div. > But > still that div is not replaced. Don''t know why.But have you checked that the div actually has that id? Does the generated javscript look sane ? Fred --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung wrote:> On 20 May 2008, at 10:07, Suneeta Km wrote: > >>>> CiRelation.find_all_by_ci_id(params[:id]), :relation => ''parents'', >> But >> still that div is not replaced. Don''t know why. > > But have you checked that the div actually has that id? Does the > generated javscript look sane ? > > FredYes I checked the generated html code. The div has correct id. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 20 May 2008, at 10:57, Suneeta Km wrote:> > Frederick Cheung wrote: >> On 20 May 2008, at 10:07, Suneeta Km wrote: >> >>>>> CiRelation.find_all_by_ci_id(params[:id]), :relation => ''parents'', >>> But >>> still that div is not replaced. Don''t know why. >> >> But have you checked that the div actually has that id? Does the >> generated javscript look sane ? >> >> Fred > > Yes I checked the generated html code. The div has correct id.Whack a breakpoint in your javascript and follow what happens (because you''re using rjs you''ll have to stick the breakpoint in prototype first (evalResponse is probably a good place )) Fred> > -- > Posted via http://www.ruby-forum.com/. > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Perhaps not for beginners but at some point in my rails development work I realized that complex rjs files can be more trouble than they are worth. For one, it is basically just masking javascript with ruby for no good reason frankly and doing anything non-trivial (if statements, loops etc) are generally easier in javascript anyways. How do you rectify this then? Two ways...simple way is simply write the function in pure javascript and then invoke it in the rjs...i.e page.call "someFunction", "param1", "param2" but what if I REALLY want to be able to dynamically evaluate ruby code as part of the template....I have used a plugin called MinusMOR http://agilewebdevelopment.com/plugins/minusmor Basically allows you to write javascript and embed ruby much the same way as writing html and embedding ruby in erb. Anyways, just something to think about. Javascript is not evil (in my opinion) and often it is actually easier just to bite the bullet and use it directly. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 20 May 2008, at 11:53, Nathan Esquenazi wrote:> > Perhaps not for beginners but at some point in my rails development > work > I realized that complex rjs files can be more trouble than they are > worth. For one, it is basically just masking javascript with ruby > for no > good reason frankly and doing anything non-trivial (if statements, > loops > etc) are generally easier in javascript anyways. How do you rectify > this > then?> Two ways...simple way is simply write the function in pure javascript > and then invoke it in the rjs...i.e page.call "someFunction", > "param1", > "param2" > > but what if I REALLY want to be able to dynamically evaluate ruby code > as part of the template....I have used a plugin called MinusMOR > > http://agilewebdevelopment.com/plugins/minusmor >Neat. Not surprising to see yet another excellent thing from Dan Webb!. With the latest stuff I''ve been I doing I''ve taking to just the writing the javascript statically. Actions render :json (or just html fragments) and the ajax callbacks on the other side put things together. With a good dose of prototype javascript isn''t that bad. And I can write better unit tests for my static javascript than I can for generated javacscript. Fred -- My ramblings: http://www.spacevatican.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
page.select("##{params[:id]}parents").any(elem){|elem|.replace_html ''blah''} page.select will return a collection of dom elements that match a css selector, so the first part of that line is selecting the element with id=''xparents'' The second half of the line (*.any(){}) translates to a javascript iterator on the returned collection. I have not tested that particular code but I''ve used rjs like it to conditionally update the browser in the past. On May 20, 7:01 am, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 20 May 2008, at 11:53, Nathan Esquenazi wrote: > > > > > > > Perhaps not for beginners but at some point in my rails development > > work > > I realized that complex rjs files can be more trouble than they are > > worth. For one, it is basically just masking javascript with ruby > > for no > > good reason frankly and doing anything non-trivial (if statements, > > loops > > etc) are generally easier in javascript anyways. How do you rectify > > this > > then? > > Two ways...simple way is simply write the function in pure javascript > > and then invoke it in the rjs...i.e page.call "someFunction", > > "param1", > > "param2" > > > but what if I REALLY want to be able to dynamically evaluate ruby code > > as part of the template....I have used a plugin called MinusMOR > > >http://agilewebdevelopment.com/plugins/minusmor > > Neat. Not surprising to see yet another excellent thing from Dan > Webb!. With the latest stuff I''ve been I doing I''ve taking to just the > writing the javascript statically. > Actions render :json (or just html fragments) and the ajax callbacks > on the other side put things together. With a good dose of prototype > javascript isn''t that bad. And I can write better unit tests for my > static javascript than I can for generated javacscript. > > Fred > > -- > My ramblings:http://www.spacevatican.org--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 20 May 2008, at 10:07, Suneeta Km wrote:> > Frederick Cheung wrote: >> On 20 May 2008, at 09:50, Suneeta Km wrote: >>> >>> I tried the following: >>> page << "if $(''#{params[:id]}parents''){"If you''d checked the generated javascript you would have seen that there''s an obvious syntax error here. It should be page << "if($(''#{params[:id]}parents'')){" Fred>>> >> >>> >>> page["#{params[:id]}parents"].replace :partial => >>> ''cipart/expanded_item'', :locals => { :expand_items => >>> CiRelation.find_all_by_ci_id(params[:id]), :relation => ''parents'', >>> :ci_id=>params[:ci_id] } >>> page << "}" >>> >>> If div exists, the partial file is executed. But it is not replaced >>> and >>> the result is not displayed. >> >> You''ve probably got the wrong div id. Poke around in firebug. >> >> Fred > > > I printed the div id in an alert box and obtained the correct div. > But > still that div is not replaced. Don''t know why. > -- > Posted via http://www.ruby-forum.com/. > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung wrote:> On 20 May 2008, at 10:07, Suneeta Km wrote: > >> >> Frederick Cheung wrote: >>> On 20 May 2008, at 09:50, Suneeta Km wrote: >>>> >>>> I tried the following: >>>> page << "if $(''#{params[:id]}parents''){" > > If you''d checked the generated javascript you would have seen that > there''s an obvious syntax error here. It should be > page << "if($(''#{params[:id]}parents'')){" > > FredThank you so much Fred. It was a syntax error. I gave page << "if($(''#{params[:id]}parents'')){" and it worked. Thanks Suneeta -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---