Dan W.
2006-Nov-30 00:31 UTC
link_to_remote; how do I tweak the div to update?; Ajax on Rails
I''m trying to update a specific div section by trying to add some
embedded ruby code below. It''s not liking it though. You see below
i''m trying to replace >>> :update =>
"msg_box>", <<< with >>> :update
=> "msg_box_<%= item.id %>", <<< but it''s
bad syntax or something. How
can I do this?
Here''s my little Ruby on Rails webpage that uses Ajax:
<% for item in @my_items %>
<html>
<head>
<title>Ajax Demo</title>
<%= javascript_include_tag "prototype" %>
</head>
<body>
<div id="msg_box">
<%= link_to_remote( "Item Details",
### normally its :update => "msg_box>",
:update => "msg_box_<%= item.id %>",
### you see in the line above i''m trying to update the div with id
"msg_box_1" for example...
:url =>{ :action => :get_details }) %>
</div>
</body>
</html>
<% end %>
<<<<<
Thanks for reading.
--Dan W.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
Philip Hallstrom
2006-Dec-03 03:12 UTC
Re: link_to_remote; how do I tweak the div to update?; Ajax on Rails
> I''m trying to update a specific div section by trying to add some > embedded ruby code below. It''s not liking it though. You see below > i''m trying to replace >>> :update => "msg_box>", <<< with >>> :update > => "msg_box_<%= item.id %>", <<< but it''s bad syntax or something. How > can I do this? > > Here''s my little Ruby on Rails webpage that uses Ajax: > > > <% for item in @my_items %> > <html> > <head> > <title>Ajax Demo</title> > <%= javascript_include_tag "prototype" %> > </head> > <body> > <div id="msg_box"> > <%= link_to_remote( "Item Details", > ### normally its :update => "msg_box>", > :update => "msg_box_<%= item.id %>", > ### you see in the line above i''m trying to update the div with id > "msg_box_1" for example... > :url =>{ :action => :get_details }) %> > </div> > </body> > </html> > <% end %> > > <<<<<<%= link_to_remote...... :update => "msg_box_#{item.id}",...... -philip --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Dan W.
2006-Dec-06 01:31 UTC
Re: link_to_remote; how do I tweak the div to update?; Ajax on Rails
That is EXACTLY what i''m looking for. Thanks Philip! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
jzakiya
2006-Dec-06 03:11 UTC
Re: link_to_remote; how do I tweak the div to update?; Ajax on Rails
Check out some of the Ajax examples in the last chapter (11) of this: "Beginning Ruby on Rails", Steve Holzner, Wrox Nov. 2006 http://www.wrox.com/WileyCDA/WroxTitle/productCd-0470069155.html --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---