# Does Javascript allow download from a server to local file s

**URL:** <https://www.ruby-forum.com/t/does-javascript-allow-download-from-a-server-to-local-file-s/106842>\
**Category:** Rails\
**Created:** [June 14, 2007, 3:43pm UTC](https://www.ruby-forum.com/t/does-javascript-allow-download-from-a-server-to-local-file-s/106842 "2007-06-14T15:43:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![gilles](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/ce7236/32.png) [@gilles](https://www.ruby-forum.com/u/gilles)\
**Post date:** [June 14, 2007, 3:43pm UTC](https://www.ruby-forum.com/t/does-javascript-allow-download-from-a-server-to-local-file-s/106842/1 "2007-06-14T15:43:38Z")

</div>

Does Javascript allow download from the server to the local  
filesystem ?  
I ask that because i am trying to initiate a file download through a  
link\_to\_function method which contains an Ajax.Request … Here it  
is :  
\<%= link\_to\_function(“Ajax Download Pic”,  
"new Ajax.Request(’/main/dl\_photos/  
#{personne.id}?index=1’, {});  
") %\>

The file does download as it is shown in the terminal with a Sending  
XXX.jpg and status 200 Ok, but i don’t see how to use the resulting  
response … i know i have to use the onComplete function(request) {},  
but how can i implement the function to save the file on the desktop ?

Thx.
