コントローラーメソッドにAJax呼び出しを行おうとしていますが、何を試してもパラメーターはnullです。私はすべての同様のSO投稿をフォローしましたが、役に立ちませんでした。答えがあれば申し訳ありませんが、見つかりません。私が持っているコードは...
Ajaxコール
var sguid = $(nTr).attr('id');
$.ajax({
url: "/Dashboard/Reporting/GetBlacklistedSoftwareItems",
type: 'POST',
dataType: 'json',
data: JSON.stringify({guid: sguid}),
statusCode: {
404: function() {
alert("page not found");
}
},
success: function (data) {
//DO Something
},
error: function () {
alert("error");
}
});
コントローラ方式
public JsonResult GetBlacklistedSoftwareItems(string guid)
{
List<DeviceSoftware> ldevice = new List<DeviceSoftware>();
Guid i = Guid.Parse(guid);
ReportMethods reportingMethods = new ReportMethods();
ldevice = reportingMethods.GetNonCompliantApplicationReport(CompanyId);
DeviceSoftware ds = ldevice.Find(x => x.Device.Guid == i);
List<DeviceApplication> da = new List<DeviceApplication>();
if (ds != null)
{
da = ds.DeviceApplications;
}
return Json(da, JsonRequestBehavior.AllowGet);
}
メソッドはguid
常にヒットしていnull
ます。 sguid
私が渡そうとしているデータを保持しています。誰かが私が欠けているものを教えてもらえますか?