Forum: Ruby on Rails send_file using AJAX

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.
Sudhi K. (Guest)
on 2009-03-26 08:25
I have a AJAX based form and when I use send_file there is no pop-up
that appears to prompt user to download file... how do I fix this?

Regards,
Sudhindra
(Guest)
on 2009-03-26 09:50
(Received via mailing list)
On 26 Mar., 07:25, Sudhi K. <removed_email_address@domain.invalid>
wrote:
> I have a AJAX based form and when I use send_file there is no pop-up
> that appears to prompt user to download file... how do I fix this?

http://www.catb.org/~esr/faqs/smart-questions.html#beprecise

--
Best regards,
David K.
http://twitter.com/rubyguy
Phlip (Guest)
on 2009-03-26 13:54
(Received via mailing list)
Sudhi K. wrote:

> I have a AJAX based form and when I use send_file there is no pop-up
> that appears to prompt user to download file... how do I fix this?

Did you Google for that first? It's a FAQ in Ajax-land, because browsers
have
security constraints that prevent JavaScript from manipulating file
input elements.

The answer is do old-fashioned Ajax that bypasses JavaScript. When a
form's
target field is the name of a 1-pixel <iframe> (and when it's not a
remote_form_* and hence calls no JS), submitting the form will send its
data
into that <iframe>, and into your server without refreshing your page.

Google for that FAQ to learn how to update your page after the call,
because I
forget.

--
   Phlip
   http://www.zeroplayer.com/
This topic is locked and can not be replied to.