I am trying to make an AJax call to a controller method the parameter is null no matter what I try. I have followed all the similar SO posts but to no avail. Sorry if the answer is there, I cant find it. The code I have is...
Ajax Call
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"); } }); Controller Method
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); } The method is being hit its just guid is alway null. sguid does hold the data I am trying to pass. Can someone tell me what I am missing?