neylitalo Posted July 11, 2007 Share Posted July 11, 2007 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 More sharing options...
neylitalo Posted July 11, 2007 Author Share Posted July 11, 2007 Solved - I was using the onclick attribute of the <a> element to trigger the AJAX call, where the href attribute worked much better. Link to comment https://forums.phpfreaks.com/topic/59449-solved-forcing-file-downloads-with-ajax/#findComment-295622 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.