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
https://forums.phpfreaks.com/topic/59449-solved-forcing-file-downloads-with-ajax/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.