我在我的控制器之一中使用了下面的代碼;asp.net mvc ajax post - redirecttoaction不起作用
if (Request.IsAjaxRequest()) {
return RedirectToAction("PreviewAndSendEmail");
}
我調試它,它來到返回線,但重定向沒有發生。是否有可能在Ajax.BeginForm中做到這一點?這裏是剃刀代碼;
using(Ajax.BeginForm(new AjaxOptions { LoadingElementId = "loading" })) {
<b>Choose E-mail Template : </b>@Html.DropDownList("emailtemps")<br /><br />
<input type="submit" value="Preview & Send" />
<span id="loading" style="display: none;">
<img title="loading..." alt="load" src="@Url.Content("~/Content/App_Icons/gifs/loading.gif")"
</span>
}
可能重複http://stackoverflow.com/questions/3534956/how-can-i-redirecttoaction-within-ajax-callback – 2011-02-18 13:36:50