I have the following view , which contains an Ajax.BeginForm:-
@using (Ajax.BeginForm(\"ChangeDevicesSwitch\", \"Switch\", new AjaxOptions
{
InsertionMo
Return the url you want to make a redirect to from the action method when the operation succeeded:
public ActionResult ChangeDevicesSwitch(SwitchJoin s)
{
try
{
...
return Json(new { RedirectUrl = Url.Action("Details", new { id = s.GeneralSwitchTo }) });
}
...
}
And in the createsuccess
:
function createsuccess(data) {
if (data.RedirectUrl)
window.location.href = data.RedirectUrl;
}