需要从jquery更改url和参数

需要从jquery更改url和参数,jquery,html,url,routes,jsrender,Jquery,Html,Url,Routes,Jsrender,HTML: $.views.helpers({ url:函数(名称、类型){ 返回encodeURI(@Url.Action(“index”,“home”,new{id=ViewContext.RouteData.Values[“id”]})); } 我需要从jquery中刷新此参数id。我不想使用任何伪值并从jquery中替换它。因为id可能是任何东西,所以我无法从伪值替换为jquery 我试着像下面那样 <a class="col-lg-12" href="{{:~url(name

HTML:


$.views.helpers({
url:函数(名称、类型){
返回encodeURI(@Url.Action(“index”,“home”,new{id=ViewContext.RouteData.Values[“id”]}));
}
我需要从jquery中刷新此参数id。我不想使用任何伪值并从jquery中替换它。因为id可能是任何东西,所以我无法从伪值替换为jquery

我试着像下面那样

<a class="col-lg-12" href="{{:~url(name, type)}}" data-toggle="tooltip">

$.views.helpers({
        url: function (name, type) {
            return encodeURI("@Url.Action("index", "home", new { id = ViewContext.RouteData.Values["id"]})");
        }

$(“a”).attr(“href”),“它怎么不起作用?它只是我也尝试过加载()的形式。但没有工作。”。
$("a").attr("href", '<%= Url.Action("index", "home", new { id= ' + $("a li.active").attr("data-value")}) %>');