[英]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.