sábado, 10 de diciembre de 2016

Adding page navegation to a MVC button on click event using jQuery

Declare a button:

<button type="submit" id="btSubscription" >Obtener una suscripción</button>


After that, add jQuery function:

<script type="text/javascript">

    $(document).ready(function () {

        $("#btSubscription").click(function (event) {
            event.preventDefault();
            var url = '@Url.Action("Subscriptions", "Home")';
            window.location.href = url;
        });

    });

</script>