Joe
Joe

Reputation: 4183

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

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 };

Upvotes: 3

Views: 1466

Answers (1)

McGarnagle
McGarnagle

Reputation: 102753

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

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

Upvotes: 4

Related Questions