How to pass dynamic value in @Url.Action?

前端 未结 3 449
盖世英雄少女心
盖世英雄少女心 2020-12-30 00:33

I have written following jquery in my partial view:

    $.ajax({
        type: \"POST\",
        url: \'@Url.Action(\"PostActionName\", \"ControllerName\")\'         


        
3条回答
  •  伪装坚强ぢ
    2020-12-30 01:15

       function functionName(var1, var2) {var link = '@Url.Action("MethodName", "Controller", new { id = "-1", name = "-2" })';
        link = link.replace("-1", var1);
        link = link.replace("-2", var2);}
    

    before, replace:

     html += " Name Button"
    

提交回复
热议问题