jQuery post request (not AJAX)

前端 未结 5 1934
醉酒成梦
醉酒成梦 2020-11-29 21:54

In an ASP.NET MVC app I use jQuery for posting data on button-click:


....
$.post(\'<%=         


        
5条回答
  •  误落风尘
    2020-11-29 22:12

    If you're doing a full redirect after a post, then why do it with Ajax? You should be able to perform a tradtional POST here and have it successfully redirect.

    If you really want an ajax request to go through and still redirect, a very easy and non-intrusive way to do that would be to return a JavascriptResult from your action instead of a RedirectResult:

    return JavaScript("window.location = " + returnUrl);
    

提交回复
热议问题