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 8801809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:55:47+00:00 2026-06-14T00:55:47+00:00

is it possible to output a file as a response from a ajax call?

  • 0

is it possible to output a file as a response from a ajax call?
i’ve wrote a function for outputting zip files using an ajax call, this is the code:

<script type="text/javascript">

    $(document).ready(function () {

        $(".ziplink").click(function (e) {
            e.preventDefault();
            var url = $(this).attr('href');
            var spinner = $(this).parent().children(".spinnerbox");
            spinner.show();
            $.ajax({
                url:url,
                type:"GET",
                dataType:"application/x-zip-compressed",
                success:function (data) {
                    console.log('success');
                    spinner.hide();

                },
                error:function () {
                    console.log('ko');
                    spinner.hide();
                }

            });
        });

    });
</script> 

now, from the firebug console everything is ook, but i dont have file output. what is missing?

Although this is fully functional in the non-ajax way (a simple link to the action), i’d like to have the spinner animation while server process the request.

thanx – LuKe

  • 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-14T00:55:48+00:00Added an answer on June 14, 2026 at 12:55 am
    $(".ziplink").click(function (e) {
    
        e.preventDefault();
        var _self = $(this);
        $('.spinner').show();
    
        $.ajax({
            type : 'HEAD',
            url : _self.attr('href'),
            complete : function(){
    
                $('.spinner').hide();
                var _tmp = $('<iframe />')
                    .attr('src', _self.attr('href'))
                    .hide()
                    .appendTo(_self)
                    setTimeout(function(){
                        _tmp.remove();
                    },5000);
    
            }
    
        });
    
    });
    

    Demo http://jsfiddle.net/4sMsr/3/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is is possible to prevent Wget from making an output file when there is
Is it possible to output specific JSON data (exported from Firefox bookmarks) using PHP.
I want to create and return a zip file from my server using JaxRS.
Is it possible to output a pdf on the fly using: Response.ContentType=Application/pdf I have
Possible Duplicate: Create Excel file in Java How to save output in excel format
Does it possible to execute php file and store its output into some variable?
Is it possible to format output with write.table? I can left-align columns using tab,
I've begun using ASPUnit to unit test my classic ASP code. This is all
it's possible to change N (for example second occurrence) in file using one-line sed/awk
Is it possible to dependency-check multiple inputs for each output when using MSBuild batching?

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.