Tips 1 通过JS动态传递Action的参数
通过Js改变form提交的路由,动态拼接参数。
模板: {actionName}/{controllerName}?{p1=xxx}&{p2=xxx}……
$("#showcurrent").click(function(e) {
var s = $("#tree").getTCT();
if (s != null) {
alert(s.text, s.id);
var paras = "?" + "TCT=" + s.text + "&" + "TSV=" + s.id;
this.form.action = '<%= Url.Action("GetJqTree", "Orders")%>' + paras;
// alert(this.form.action);
}
else
alert("NULL");
});
后台代码
public ActionResult GetJqTree(string TCT,string TSV)
{
return View();
}
这种做法url就不好看了.不知道通过路由规则能不能搞定它。