我想使用Request.Form方法将因子ID传递给控制器,我尝试在name属性中传递它,但是它不起作用
这是我的Jquery函数:
$("#categoryId").change(function () {
$.get("/Organization/GetFactorsList", { Id: $("#categoryId").val() }, function (data) {
$("#factors").empty();
$.each(data, function (index, row) {
$("#factors").append("<div class='row factors'><div
class='col-md-3'><div class='checkbox'><label><input type='checkbox'
id='blankCheckbox' value='option1' name='" + row.id + "'/></label></div>
</div><div class='col-md-9 factor'>" + row.Name + "</div></div>")
});
});
})
答案 0 :(得分:0)
尝试此解决方案:
$("#categoryId").change(function () {
$.get("/Organization/GetFactorsList",data : { Id: $("#categoryId").val() }, function (data) {
$("#factors").empty();
$.each(data, function (index, row) {
$("#factors").append("<div class='row factors'><div
class='col-md-3'><div class='checkbox'><label><input type='checkbox'
id='blankCheckbox' value='option1' name='" + row.id + "'/></label></div>
</div><div class='col-md-9 factor'>" + row.Name + "</div></div>")
});
});
})
您忘记添加数据:{ID:$(“#categoryId”)。val()}