[英]Updating view by calling Action Method from Javascript
我有一个像这样的javacript:
<script>
function GetFromDate() {
var dt1 = document.getElementById('fromDate').value;
var dt2 = document.getElementById('toDate').value;
var url = "Statistics/Excel/" + dt1 + "!" + dt2;
window.location.href = url;
return false;
};
</script>
在控制器中,我的ActionResult是这样的:
public ActionResult Excel(string id)
{
\\ View Creation
if(SomeLogic)
{
\\Excel Download Options
}
return View(viewModel);
}
尽管它可以与Excel Downloading选项完美配合,但不会返回View。 有什么建议么? 有关更多信息,“ viewModel”对象包含要显示的完美数据。
如果您的响应返回文件下载,那么这将算作您的Http响应,您将无法在同一操作中进行重定向。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.