ASP.NET MVC使用ajax請求時不能在Action中使用RedirectToAction實現跳轉

參考以下地址:
https://www.it1352.com/48944.html
作者的說法如下:
“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.”
所以,如果需要異步請求處理數據後跳轉到其他頁面,需要在前端收到請求結果後再做進一步處理。

以上問題是在開發中遇到的,百度搜索不盡如人意,看到這個文章後將作者的解決方案放在這裏以做記錄。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章