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!!!! -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Feb 25, 4:41 pm, Guille San <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> 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> > <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!!!! > -- > Posted viahttp://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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Frederick Cheung wrote:> On Feb 25, 4:41�pm, Guille San <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> 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 > > FredOk. 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!! -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Feb 25, 6:05 pm, Guille San <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> 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 -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Frederick Cheung wrote:> On Feb 25, 6:05�pm, Guille San <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> 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 > > FredThanks, 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!! -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Feb 26, 5:11 pm, Guille San <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Frederick Cheung 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 -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Frederick Cheung wrote:> On Feb 26, 5:11�pm, Guille San <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> Frederick Cheung 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. > > FredOk, 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 -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Feb 26, 6:24 pm, Guille San <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Frederick Cheung wrote: > > On Feb 26, 5:11 pm, Guille San <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: > >> Frederick Cheung 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 >You need to write an action that only renders that div 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
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 Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Feb 26, 6:24 pm, Guille San <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: > > > Frederick Cheung wrote: > > > On Feb 26, 5:11 pm, Guille San <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: > > >> Frederick Cheung 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 > > You need to write an action that only renders that div > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Frederick Cheung wrote:> On Feb 26, 6:24�pm, Guille San <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> 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 > > FredHi 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!! -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Thanks a lot!! I solve that problem. Anyway thanks a lot -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.