authenticity_token shows up in the url when page reloads

I'm pretty new to Ruby On Rails (and somewhat self-taught), so bear with me if I'm asking something stupid. So whenever I push my download button (which just uses send_file, if that's any help) it reloads the page, without downloading, and it puts the authenticity_token in the url. This all the button is: <% form_remote_tag :url => { :action => 'download'} do %>       <%= submit_tag "Download" %> <% end %>

Basically, it's just not working at all, and I would appreciate any sort of help with the issue. Thanks in advance.

Downloading a file is a “full page refresh” (although the page won’t actually refresh). You shouldn’t use an AJAX function (whether that’s a link or a form) to send a file to the client. Just serve it up with the right content type as a normal request and you’ll be fine.

Best regards

Peter De Berdt

Peter De Berdt wrote:

Downloading a file is a "full page refresh" (although the page won't actually refresh). You shouldn't use an AJAX function (whether that's a link or a form) to send a file to the client. Just serve it up with the right content type as a normal request and you'll be fine.

I get what you're saying and I've tried a few different methods. But alas, I am a beginner and have not gotten anything to work. Would you maybe happen to have any specific ideas as to how I could remedy my solution. Thanks again for your help.

Nevermind, I got it... Still couldn't have gotten it without your help. Thanks.