Calling action method in MVC with jQuery and parameters not working

前端 未结 2 1254
一向
一向 2021-02-10 23:02

I\'m trying to call an action method in an MVC application using jQuery. Basically what I want is to take the value of a couple of input fields and call the action method by cli

2条回答
  •  攒了一身酷
    2021-02-10 23:29

    Try like this:

    var number = $('#selectWeekId').val();
    var year = $('#selectYearId').val();
    var url = '<%: Url.Action("Edit") %>';
    $.get(url, { number: number, year: year }, function (data) {
        alert('Test');
    });
    

提交回复
热议问题