开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜