How to pass ID via JavaScript to a View

1

In the application I'm developing I use Views of type modal .

I use this code to display the modal :

<button class="btn btn-default details" data-id="@clientes.Codigo"><i class="glyphicon glyphicon-file"></i></button>

$(".delete").click(function () {
    var id = $(this).attr("data-id");
    $("#modal").load("Excluir?id=" + id, function () {
        $(".modal").modal();
    })
});

I see that my Modal uses a data-id to pass the ID value, my problem is as follows, I need do something like this but I will not use a modal but a normal View , what would my javascript look like for this?

    
asked by anonymous 15.10.2015 / 02:35

1 answer

3

You do not even need to use JavaScript. A normal link already solves everything.

onclick="location.href='@Url.Action("Cadastro", "Cliente", new { id })'"
    
15.10.2015 / 02:51