我正在从 MVC 3 网站生成 CSV 并使用 FileContentResult 将其传递给用户。这很好用,但生成 csv 需要 30 秒,因此需要 30 秒才能提示用户保存。
public virtual FileContentResult GetSpreadsheet(string id)
{
var service = new SpreadsheetService();
var result = service.GetCSV();
return File(new System.Text.UTF8Encoding().GetBytes(result.Message), "text/csv", "Report123.csv");
}
所以我想我只是通过 JQuery 调用它——但这(毫不奇怪!)只是将 CSV 转储到页面。
$.post("/Home/GetSpreadsheet/" + id, null, function (data) {
$('#resultDiv').html(data);
});
有谁知道我将如何生成提示保存现在我已经取回了数据?谢谢