Issues with update div using ajax

Hi!
I have been trying to use periodically_Call_remote in a table showing
various devices , to update a row specific to a device.

my view looks like:

All Devices


</tr>

<% @devices.each do |c|%>

<%= javascript_include_tag :defaults %> <%= periodically_call_remote(:update => "log_entry", :url => {:action => 'get_ping_entry', :id => c.id}, :frequency =>3) %> <% end %>
Device Name Ping Result
<%=h c.name%>
<%= will_paginate @devices %>

and my controller action is :

def get_ping_entry
@dev=Dev.find(params[:id])
@status= Ipaddr.find(:first,:conditions=>[“dev_id
=?”,@dev.id]).status
render_text "status "[email protected]_s
end

its working fine but its updating only the first row i.e. its showing
result of periodically call remote for every device in the first row
only…not in the corresponding row for each device…

can you please help me with this??
thanking in advance

On 20 May 2008, at 07:53, sup wrote:

=> ‘get_ping_entry’, :id => c.id}, :frequency =>3) %>

Your div ids need to be unique.

Fred


My ramblings: http://www.spacevatican.org

yes i understood wats the problem… the id’s need to be unique… can you
help me with that??
i t ried some methods but no help !!
once again thanx alot for your prompt reply!

On Tue, May 20, 2008 at 1:39 PM, Frederick C. <

On 20 May 2008, at 09:15, supriya agarwal wrote:

yes i understood wats the problem… the id’s need to be unique… can
you help me with that??
i t ried some methods but no help !!
once again thanx alot for your prompt reply!

just generate a unique string “log_entry_#{c.id}”

Fred

On 20 May 2008, at 09:59, supriya agarwal wrote:

i tried with this … this isnt working , updating nothing on the page

<%= javascript_include_tag :defaults %>
<%= periodically_call_remote(:update =>“log_entry_#{c.id}”, :url =>
{:action => ‘get_ping_entry’, :id => c.id}, :frequency =>3) %>

Get your erb right: <%= c.id%> (you could tell this was the problem by
looking at the html output)

Fred

i tried with this … this isnt working , updating nothing on the page

<%= javascript_include_tag :defaults %>
<%= periodically_call_remote(:update =>“log_entry_#{c.id}”, :url =>
{:action => ‘get_ping_entry’, :id => c.id}, :frequency =>3) %>

On Tue, May 20, 2008 at 2:18 PM, Frederick C. <

Hey!

Thanx alot! it worked fine :slight_smile:

Thanx boss…!

On Tue, May 20, 2008 at 3:14 PM, Frederick C. <

If you’re in Rails 2.x, use the dom_id method to create the id

~

Or, since you specifically want a div:

<% div_for device do %>

<% end %>