如何从actionlink调用jquery函数。我的this.href结果: “localhost:54678 / Customer?param = 1”但我需要this.href: “本地主机:54678 /客户/ EditCustomer / PARAM = 1” Customer是Controller,EditCustomer是Action。
Jquery的:
$('#mylink').click(function (e) {
jQuery('#dialog').dialog('open');
var iframe = $('#frame');
alert(this.href);
$(iframe).attr('src', this.href);
e.preventDefault();
});
查看:
<%= Html.ActionLink(
"Click",
"Index",
new { param = 1 },
new { id = "mylink" })
%>
localhost:54678 / Customer / EditCustomer /?param = 1如何调用此方法?
答案 0 :(得分:1)
这个怎么样?
<%= Html.ActionLink(
"Click",
"EditCustomer",
new { param = 1 },
new { id = "mylink" })
%GT;
答案 1 :(得分:0)
您的ActionLink指向Customer控制器的Index操作。将其更改为EditCustomer,如下所示:
<%= Html.ActionLink(
"Click",
"EditCustomer",
new { param = 1 },
new { id = "mylink" })
%>