Forum: Ruby on Rails send_data not working properly with link_remote_to

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
3c8acea869ba14f912b72eb74d1a1a8f?d=identicon&s=25 Srinivas Muddana (muddana)
on 2006-05-17 19:26
 I'm reading an image in an link_to_remote call,and then using send_data
i send the read image as :type => "image/png" :disposition =>
"inline"...but when the div tag gets updated i see only ascii characters
.....but if i do the same operation using normal call(link_to) i see it
functioning normal ....could someone explain .

my view:
<%= link_to_remote("flip",
     :update => "img",
     :url => {:action => "flip"}
     )%>
<div id="img"></div>

controller:
def flip
   filename="/public/picture/filename/1/scaler_1.jpg"
    img=File.read(filename)
    ilist = Magick::ImageList.new
    @picture=ilist.from_blob(img)
    @picthumb=@picture.flip!
    @out=@picthumb.to_blob
    send_data(@out,:filename =>'workshopimage', :type => "image/png",
:disposition => "inline")
end

the above doesnt work
but with my view as
<%= link_to("flip",
     :action => "flip"
     )%>
it works....so doesnt it mean i need to do some thing more incase of an
ajax call ..am i missing something ..?
This topic is locked and can not be replied to.