Rails 3.1.3 This should be a basic question but it does not work for me, so I need some help. I would like to insert an image with jQuery after loading the page is done. More specifically, $(''#combine'').click(function () { $(''#tempimage'').html(''<img src="/images/arrow_close.png">''); }); this way. It does not work. I understand that the problem is the PATH. The image is saved in "app/assets/images". $(''#combine'').click(function () { $(''#tempimage'').html(''<%= image_tag ("/images/arrow_close.png") %>''); }); this does not work either. How can I do it? Thanks in advance. soichi -- 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.
vierundsechzig-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org
2012-Feb-09 06:35 UTC
Re: Inserting a static img tag with jQuery
This here is useful stuff to read: http://guides.rubyonrails.org/asset_pipeline.html If not configured differently, the images that you have stored under app/assets/images/arrow_close.png end up with an url of "/assets/ arrow_close.png" - it''s always a good idea to try this out in the browser first and to check the console to see how the pipeline processes the resources - the output here is usually quite verbose. hope this helps, stefan On 9 Feb., 05:59, Soichi Ishida <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Rails 3.1.3 > > This should be a basic question but it does not work for me, so I need > some help. > > I would like to insert an image with jQuery after loading the page is > done. > > More specifically, > > $(''#combine'').click(function () { > $(''#tempimage'').html(''<img src="/images/arrow_close.png">''); > }); > > this way. It does not work. I understand that the problem is the PATH. > The image is saved in "app/assets/images". > > $(''#combine'').click(function () { > $(''#tempimage'').html(''<%= image_tag ("/images/arrow_close.png") %>''); > }); > > this does not work either. > > How can I do it? > > Thanks in advance. > > soichi > > -- > 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.
Thanks for your help! It works fine now. soichi -- 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.