javascript - Pass a client side variable to @Url.Action in jQuery function - Stack Overflow

This is my code below and I am trying to pass the ID variable Url.Action methodI can't work out ho

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) {
       var ID = e.row.cells[0].innerHTML;

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

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) {
       var ID = e.row.cells[0].innerHTML;

        $.get('@Url.Action("GetTestStepByID","AlternativeTest", new { id = ID } )', function (data) {
            $('#accordion').replaceWith(data);
        }); 
    }
Share Improve this question asked Aug 25, 2011 at 21:01 JonJon 40.1k87 gold badges243 silver badges393 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 5

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);
    }); 
}

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744834636a4596189.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信