Ajax.BeginForm that can redirect to a new page and pass route value

人盡茶涼 提交于 2019-12-10 20:24:28

问题


This link shows how to redirect an @Ajax.BeginForm but not how to pass a route value to the new view.

Ajax.BeginForm that can redirect to a new page page/9391267#9391267

How would you redirect an @Ajax.BeginForm with a route value? The equivalent of

return RedirectToAction("Edit", new { id = acntId };

回答1:


It's no different, just use the Url helper overload with the route values:

return Json(new { 
    url = Url.Action("Checkout", 
        new { id = accntId }
    ) 
});


来源:https://stackoverflow.com/questions/12417668/ajax-beginform-that-can-redirect-to-a-new-page-and-pass-route-value

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!