I've got an export functionality built into my site, whereby users can choose which rows of a data table to export. They export by clicking an "Actions" dropdown and choosing "Export". This triggers an AJAX call that posts which ids to export to a PHP script, which, in turn, builds an Excel document on the fly and delivers it to the user.
Here is my code: <input type="checkbox" id="selected1" name="Interviews[]" value="21" / > <input type="checkbox" id="selected2" name="Interviews[]" value="22" / > ... inputs = []; $("#dataTableBody input[id^=selected]:checked").each(function() { inputs.push(this.name + '=' + escape(this.value)); }); $.ajax({ type: "POST", data: inputs.join('&'), url: "/gateway/excel.php", success: function(){ return true; }, error: function(XMLHttpRequest, textStatus, errorThrown){ return false; } }); In Firebug, I'm getting the data in TSV format, but I'm not being presented the download dialog within my browser. If this was a straight file download, I would link directly to it, but the file has to be built dynamically. Can I set the dataType option in the ajax call to be "file" or something? What are my options?