Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

205
Views
Coldfusion download file

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.

Here is my coldfusion function which is stored in cfc:

<cffunction name="download" access="remote" output="true">
    <cfset file_name = "Test.xlsx">
    <cfheader name='Content-Disposition' value='attachment; filename=#file_name#' charset='utf-8'> 
    <cfcontent type="application/msexcel" file="#file_name#" deletefile="false">
</cffunction>

Here is my ajax call:

<script>
        $.ajax({
            method: "GET",
            url: "ses/dev.cfc",
            data: {
                method: 'download'
            },
            cache: false,
            success: function(data) {
                console.log("Downloaded");
            },
            error: 'Not downloaded'
        });
    </script>

And here is my result: http://imgur.com/FmPhlKx

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

I think you'll that downloading function should be remove inside Ajax, and move that to different process... maybe call it on different URL something like this:

http://websiteurl.com/download.php?file=xxxxx&sec_string=xxxxxx etc

I hope this make sense :)

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!