asp.net mvc ajax post - redirecttoaction not working

前端 未结 2 851
南旧
南旧 2020-12-18 05:42

I used the following code in one of my controller;

            if (Request.IsAjaxRequest()) {
            return RedirectToAction(\"PreviewAndSendEmail\");
          


        
相关标签:
2条回答
  • 2020-12-18 06:26

    You can't redirect in an AJAX action from the server. If you want your browser to redirect in an AJAX action you need to do it from javascript. Obviously using AJAX to redirect is absolutely useless. If you intend to redirect use a normal Html.Begin form and don't bother with AJAX.

    0 讨论(0)
  • 2020-12-18 06:28

    Why don't you call the PreviewAndSendMailEmail directly? Since you don't need the redirection itself (change in url,etc), there is no need to use it.

    0 讨论(0)
提交回复
热议问题