title: Coldfusion download file
body: <p>I want to download file via ajax get request which calls coldfusion function, but the problem is that in "network" tab in dev tools I can "see" the content, but it doesn't download it.</p>
  
  <p>Here is my coldfusion function which is stored in cfc:</p>
  
  <pre><code>&lt;cffunction name="download" access="remote" output="true"&gt;
      &lt;cfset file_name = "Test.xlsx"&gt;
      &lt;cfheader name='Content-Disposition' value='attachment; filename=#file_name#' charset='utf-8'&gt; 
      &lt;cfcontent type="application/msexcel" file="#file_name#" deletefile="false"&gt;
  &lt;/cffunction&gt;
  </code></pre>
  
  <p>Here is my ajax call:</p>
  
  <pre><code>&lt;script&gt;
          $.ajax({
              method: "GET",
              url: "ses/dev.cfc",
              data: {
                  method: 'download'
              },
              cache: false,
              success: function(data) {
                  console.log("Downloaded");
              },
              error: 'Not downloaded'
          });
      &lt;/script&gt;
  </code></pre>
  
  <p>And here is my result:
  <a href="https://imgur.com/FmPhlKx" rel="nofollow noreferrer">http://imgur.com/FmPhlKx</a></p>