开发者

Pass a client side variable to @Url.Action in jQuery function

开发者 https://www.devze.com 2023-03-30 16:08 出处:网络
This is my code below and I am trying to pass the ID variable Url.Action method I can\'t work out how to do it.

This is my code below and I am trying to pass the ID variable Url.Action method

I can't work out how to do it.

Thanks

function onRowSelected(e开发者_C百科) {
       var ID = e.row.cells[0].innerHTML;

        $.get('@Url.Action("GetTestStepByID","AlternativeTest", new { id = ID } )', function (data) {
            $('#accordion').replaceWith(data);
        }); 
    }


You can try this

function onRowSelected(e) {
   var ID = e.row.cells[0].innerHTML;

    $.get('@Url.Action("GetTestStepByID","AlternativeTest")' + '/' + ID, function (data) {
        $('#accordion').replaceWith(data);
    }); 
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号