我的控制器操作有以下代码
[HttpPost]
public async Task<IActionResult> MonthsToAdd(List<string> months)
{
}
Run Code Online (Sandbox Code Playgroud)
我的ajax代码如下所示
$("#btnSave").on("click", function () {
var months= [];
var value = $("input[name=monthsAvailable]:checked").val()
var lengths = $("input[value=" + value + "]").closest(".row").index()
console.log($("input[value=" + value + "]").closest(".row").index())
for (var i = 0; i <= lengths; i++) {
months.push($(".outer .row:eq(" + i + ") input:radio").val())
}
console.log(JSON.stringify(months));
$.ajax({
contentType: 'application/json;',
dataType: 'json',
type: 'POST',
url: '/AreaName/Controller/MonthsToAdd',
data: JSON.stringify({ 'months': months}),
success: function (response) {
alert("success.");
}
});
});
Run Code Online (Sandbox Code Playgroud)
在浏览器控制台中,我看到所有正确的参数,但 MVC 操作未接收参数。array.count shows 0 …
我有以下表结构。如何创建视图或创建选择语句添加一列,该列显示来自同一表中相同 notice# 字段的另一条记录的值。
ID notice# notice Date Sequence
1 ABCD1 1/2/2021 1
2 ABCD1 1/3/2021 2
3 ABCD1 1/3/2021 3
4 ABCD2 1/3/2021 1
5 ABCD2 1/3/2021 2
Run Code Online (Sandbox Code Playgroud)
预期结果:我想添加一个新列预先通知日期为
ID notice# notice Date Sequence Prior Noice Date
1 ABCD1 1/2/2021 1
2 ABCD1 1/3/2021 2 1/2/2021
3 ABCD1 1/3/2021 3 1/3/2021
4 ABCD2 1/3/2021 1
5 ABCD2 1/3/2021 2 1/3/2021
Run Code Online (Sandbox Code Playgroud)