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?

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

HOLA MUNDO

<%= link_to "My blog", posts_path %>

<%=image_tag("/guarrada/guarrada/foto2.jpg") %>

<%=image_tag("/guarrada/guarrada/foto.jpg") %>

THANKS!!!

On Feb 25, 4:41 pm, Guille S. [email protected] wrote:

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 C. wrote:

On Feb 25, 4:41�pm, Guille S. [email protected] wrote:

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

Ok. But if the thing that I wanna to refresh it´s the image, how can I
put it like a path to my server? My idea is refresh the image every
second because is an image from an specific camera. Do you think that
Ajax.Periodically updater is a good idea or do you think thaht I need to
study oher forms for image refresh

Thanks!!

On Feb 25, 6:05 pm, Guille S. [email protected] wrote:

Ok. But if the thing that I wanna to refresh it´s the image, how can I
put it like a path to my server? My idea is refresh the image every
second because is an image from an specific camera. Do you think that
Ajax.Periodically updater is a good idea or do you think thaht I need to
study oher forms for image refresh

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 C. wrote:

On Feb 25, 6:05�pm, Guille S. [email protected] wrote:

Ok. But if the thing that I wanna to refresh it�s the image, how can I
put it like a path to my server? My idea is refresh the image every
second because is an image from an specific camera. Do you think that
Ajax.Periodically updater is a good idea or do you think thaht I need to
study oher forms for image refresh

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

Thanks, but I didn´t understand what do you want to say with html
container??Can you give any example of html container??Can you say me
what kind of container I have to use??

THANKS A LOT!!

On Feb 26, 5:11 pm, Guille S. [email protected] wrote:

Frederick C. wrote:

Thanks, but I didn´t understand what do you want to say with html
container??Can you give any example of html container??Can you say me
what kind of container I have to use??

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

On Feb 26, 6:24 pm, Guille S. [email protected] 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

Frederick C. wrote:

On Feb 26, 5:11�pm, Guille S. [email protected] wrote:

Frederick C. wrote:

Thanks, but I didn�t understand what do you want to say with html
container??Can you give any example of html container??Can you say me
what kind of container I have to use??

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

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

Thanks a lot

Frederick C. wrote:

On Feb 26, 6:24�pm, Guille S. [email protected] 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!!

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’

On Feb 26, 1:21 pm, Frederick C. [email protected]

Thanks a lot!!

I solve that problem. Anyway thanks a lot