Jump to content

[SOLVED] Forcing file downloads with AJAX


neylitalo

Recommended Posts

I'm using a script to send a GET request to a particular page which generates and sends an Excel file using the PEAR Spreadsheet::Excel::Writer library, and it works absolutely fine when I just put the URL in the address bar. However, when I'm using an AJAX request, it doesn't actually send the file. I get the correct HTTP response (Firebug ftw!), but I never get the file download dialog. As I see it, there are two possibilities, neither of which are very appealing: The headers attached to that file are ignored when they come through in an XMLHttpRequest response, or I need to do something extra to get it to send the file to the browser.

 

Has anybody had any similar experiences?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.