Hi I have json request like here:
$.ajax({
url: "/DeviceUsage/FreeDevice",
type: "POST",
data: JSON.stringify({ data: Ids }),
error: function (data) {
alert("error " + data);
},
success: function (data) {
if (data === "") {
alert("succes")
}
else {
alert(data);
}
}
});
where Ids = var Ids = new Array();
( full of ints)
My Json looks like this:
{"data":[38,40,41]}
method where I'm receiving Json:
[HttpPost]
public JsonResult FreeDevice(FreeDeviceModel m)
{
return Json("");
}
and my ViewModel:
public class FreeDeviceModel
{
public List<int> data { get; set; }
}
I cross checked everything with Json validator, Json2C#
and eveything looks correct so why nothing is reveived by the FreeDevice method?
For clarification I have problem with this :
Data shoudl be List of 3 elements but is Null