最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

programmeradmin4浏览0评论

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);
    }); 
}
发布评论

评论列表(0)

  1. 暂无评论