git pull origin branch_name
On Edit点击我想将值ID和IDS传递给控制器TransportationFeeCollections和方法PayFee,我怎样才能将两个参数传递给控制器
答案 0 :(得分:0)
您在制作网址时使用了无效引号,请尝试以下内容,
row += "<td><a href='/TransportationFeeCollections/PayFee?"+
"id="+item.RouteId+"&ids="+item.RouteId+"'>Edit</a></td>";
并将行初始化为字符串而不是数组类型,将row=[]
更改为row=''
,
success: function (myResult){
var row = '';// make it string instead of array
$.each(myResult.students, function (index, item) {
row += "<tr><td>" + item.StudentAdmissionID + "</td>";
row += "<td>" + item.StudentFirstName + " " +
item.StudentMiddleName + " " + item.StudentLastName + "</td>";
row += "<td><a href='/TransportationFeeCollections/PayFee?"+
"id="+item.RouteId+"&ids="+item.RouteId+"'>Edit</a></td>";
row += "</tr>";// remember the closing tr
});
$("#contacts").html(row);
},
答案 1 :(得分:0)
尝试使用以下代码:
$.ajax({
type: "POST",
url: '@Url.Action("Action", "Contr")',
contentType: "application/json; charset=utf-8",
data: { par1: val1, par2: val2 },
dataType: "json",
success: function (myresults) {
ur code.....
}
});
控制器代码如下:
public ActionResult ActionName(string par1, string par2)
{
Your Code .......
}