I\'d like to be able to invoke a file download from rails using link to remote. I have the link working okay,it looks like this :
link_to_remote image_tag(\
An article from ParticleTree mentions a simple and effective solution that doesn't involve AJAX at all, but does cause a file to download without the user leaving the current page:
<form id="super_form" method="post" action="/file/">
<input type="hidden" id="download" name="download" />
</form>
$('download').value = 'top10';
$('super_form').submit();
This doesn't directly answer your question about how to have a file download via an AJAX request, but I think this will give your end-user the experience you're looking for.