Tuesday, 26 January 2021

MVC - jQuery - Redirect to another controller


Watch this example on YouTube



@model WebApplication1.Models.OrderCustomClass

@using (Html.BeginForm("Index", "Home"))
{
    <div>
 
    </div>  
}
<input type="button" id="btnSubmit1" onclick="Redirect()" value="Redirect" />

    @section Scripts{
    <script type="text/javascript">
        function Redirect() {
            var url = "@Url.Action("Login", "Account")";
            window.location.pathname = url;

        }
    </script>
    }

No comments:

Post a Comment