AJAX update of <img> element?

Hi,

I’ve been trying to do AJAX updates of an element, but I can’t
seem to make it work.

Should it be possible to do something like this…?

[View]
<%= form_remote_tag :url => {:action => ‘sendplot’}, :update => ‘plot’
%>
<%= submit_tag %>
<%= end_form_tag %>

[Controller]
def sendplot
output_plot(…) # this sends a png file to the browser - this bit
works
end

I find that the browser (Opera or Firefox), no matter what, won’t
:update an existing tag. If I :update a

instead, I see the
png data dumped as ascii, but that isn’t very useful!

Thanks,
Chris.

If you want to replace an image and you’re updating the

, return a
new img tag, not an image file.

unknown wrote:

I’ve been trying to do AJAX updates of an element, but I can’t
seem to make it work.

Should it be possible to do something like this…?

[View]
<%= form_remote_tag :url => {:action => ‘sendplot’}, :update => ‘plot’
%>
<%= submit_tag %>
<%= end_form_tag %>

[Controller]
def sendplot
output_plot(…) # this sends a png file to the browser - this bit
works
end

I find that the browser (Opera or Firefox), no matter what, won’t
:update an existing tag. If I :update a

instead, I see the
png data dumped as ascii, but that isn’t very useful!