ajax.updater problem

Hi everyone
I´know that it is not a ajax forum, but Im using ajax ina program
created with rails code and I think that I´m not the unique person who
use the Ajax. UpdaterPeriodically.
My problem is that my program doesn´t refresh the div tag, following
it´s my source code. Anyone can say me why it doesn´t work?

<head>
<%= javascript_include_tag 'prototype' %>
</head>
<script type="text/javascript">
       {
            new Ajax.PeriodicalUpdater(imagen,
'image_tag("/guarrada/guarrada/foto.jpg")',{frequency:'1'});
        }

    </script>
<h1>HOLA MUNDO</h1>
<%= link_to "My blog", posts_path %>
<p><%=image_tag("/guarrada/guarrada/foto2.jpg") %></p>
<div id="imagen">
<%=image_tag("/guarrada/guarrada/foto.jpg") %>
</div>

THANKS!!!!

Hi everyone
I´know that it is not a ajax forum, but Im using ajax ina program
created with rails code and I think that I´m not the unique person who
use the Ajax. UpdaterPeriodically.
My problem is that my program doesn´t refresh the div tag, following
it´s my source code. Anyone can say me why it doesn´t work?

Well first off that image_tag isn't in a <%= %> so that ruby won't
get evaluated. Additionally that second paramter should be the path to
something on your server that will return an html fragment

Fred

Frederick Cheung wrote:

You can't refresh the image itself, but you can refresh whatever piece
of html contains the img tag - update the imagen div with some html
containing a different img tag to the one initially on screen

Fred

Frederick Cheung wrote:

containing, not container. I meant that you don't refresh the image
itself, you refresh the piece of html that has the img tag.

Fred

Frederick Cheung wrote:

You need to write an action that only renders that div

Fred

This is what you want:
<%= periodically_call_remote(
  :frequency => 1,
   :url => { :action => 'action' },

) %>

When the action is called it will look for an RJS file with the same
name.rjs.
in the rjs:

page[:div].replace_html :partial => ' html piece with the picture'

Frederick Cheung wrote:

> Fred

Ok, Thanks!!But �I want to refresh the div for the same div, if I put
new Ajax.PeriodicalUpdater(target,
http://localhost:3000/’,{frequency:'1’}) the result is that all the web
page appears where before I only had an image. How can I do to refresh
only that image

You need to write an action that only renders that div

Fred

Hi everyone:

I have had sucess with Ajax.periodicallyupdater but the result weren´t
be the expected, because I need to refresh the div with a frequency of
0.5 sec and with that frequency didn´t work like I need. Can you give
another idea about functions or other ajax and rails functionalities for
do that??

Thanks a lot!!

Thanks a lot!!

I solve that problem. Anyway thanks a lot