Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8434707
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T06:43:52+00:00 2026-06-10T06:43:52+00:00

I have a link when clicked processes a coldfusion page that downloads a file

  • 0

I have a link when clicked processes a coldfusion page that downloads a file from the server. When I access the file directly in the url, it works as it should, so I know that part is working. My next step is to introduce ajax so the interaction is seamless to the user. This is my event handler with the ajax call (event handler is called on initial page load):

function fileHandler(){
    $('#attachment').click(function(e){
        e.preventDefault();
        $.ajax({
            type:"get",
            url:"test.cfm",
            data:{name:"john"}
        });
    });
}

But I get nothing. This is my first time using jQuery’s .ajax(). I normally use .get() and .load(). I’ve checked the documentation and my syntax appears correct. Does anyone see the problem of why I can’t get the browser prompt to save the file? Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T06:43:53+00:00Added an answer on June 10, 2026 at 6:43 am

    You cannot trigger a “Save As” dialog trough Ajax (XMLHTTPRequest). An Ajax call returns data from your server to your javascript application, that’s the whole point about using Ajax. Downloading a file and saving it on the computer is just another use-case – that is a “browsers job”, not yours.

    I resolved that “issue” by appending a hidden iframe to the page, this will trigger a “Save as…” dialog and the user won’t notice it. It’s like opening an address in another tab, just that it’s hidden.

    $('body').append(
        $('<iframe>', { 
            src: 'test.cfm?name=john' 
        }).hide()
    );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have link that calls a function when clicked: <a href=javascript:spawnMenu(this); id=link1>Test1</a> To make
I have a link that, when clicked, should deliver an email by using an
I have a page which when an a link is clicked (which must remain
I have some jQuery code that highlights a link when clicked, and changes the
I have some code right now that executes when a link is clicked. The
I have a report that has an address field link that, when clicked, opens
So I am trying to have a div slideToggle when this link is clicked.
So, I have a link at the bottom of website. When it is clicked,
I have a href link and I would like it to be clicked when
I have a link in a Gridview that I want opened in Windows Explorer

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.