This code:
url = "/CNGInspectionReport/GetInspectionReportFilteredIssuedOnly"
reportNo = { reportNo: $("#txtReportNo").val() };
data = JSON.stringify(reportNo);
onlyReport = 1;
if (onlyReport == 1) {
data = JSON.stringify(reportNo);
}
else {
var Listdata = { reportNo: $("#txtReportNo").val(), FileHeadNo: $("#txtFileHeadNo").val() };
data = JSON.stringify(Listdata);
}
replace with:
url = "/CNGInspectionReport/GetInspectionReportFilteredIssuedOnly"
var data;
if (onlyReport == 1) {
data = {reportNo:reportNo, FileHeadNo:""};
}
else {
data = {reportNo:reportNo, FileHeadNo:FileHeadNo};
}
Remove this code from ajax:
dataType: "json",
contentType: "application/json; charset=utf-8",
dataFilter: function (data) { return data; },
and add [FromBody] to your action header:
public ActionResult GetInspectionReportFilteredIssuedOnly([FromBody] string reportNo, string FileHeadNo= "")
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…