【发布时间】:2011-02-02 13:03:07
【问题描述】:
我打算让这个函数调用返回 CSV 报告的 MVC 操作方法。
$(function() {
$('#exportButton').click(function() {
$.get('/curReport/GetCSVReport');
});
});
如果我像下面的代码那样制作一个按钮,当它被点击时,我会看到“打开方式/保存文件”窗口。
<input type="button" value="Export" onClick="location.href='CurReport/GetCSVReport'">
但是,当我将按钮更改为使用 jQuery 函数时,虽然调用了 GetCSVReport(),但我没有得到“打开方式/保存文件”窗口。
这是我的GetCSVReport()
public FileResult GetCSVReport()
{
...
return fileResult;
}
如何让我的 jQuery 函数像 onClick 一样工作?
谢谢,
亚伦
【问题讨论】:
标签: javascript jquery model-view-controller