I'm trying to send a json object (extjs client ) to asp.net server side application:
This is the request (with sample data but same logic):
var datiOrdine = [];
for (i = 0; i < elencoChk.length; i++)
{
datiOrdine.push
({
x: arr[i].value1, // string
y: arr[i].value2, // string
z: arr[i].value3, // string
k: arr[i].value4, // string (dd/MM/yyyy)
l: arr[i].value5, // double
});
}
Ext.Ajax.request({
url: '/RAMMVC/RDA/UpdateRDA',
params: { array: Ext.JSON.encode(datiOrdine) },
headers: { 'Content-Type': 'application/json; charset=utf-8' },
method: "POST",
success: function (response) {},
failure: function (response) {}
});
The json object:
[
{
"x":"GRT02",
"y":"0215000050",
"z":"0001",
"k":"30/01/2015",
"l":1413.5
}
]
And this is the method I declare on server side web application:
public ActionResult UpdateRDA(?)
{
}
How can I declare the param(?) on UpdateRDA method to receive correctly the json object? Missing any annotations?
If I declare
public ActionResult UpdateRDA(string array)
{
}
I get Invalid Json Primitives exception.
Programming languages:
client UI: extjs 4.1
server: asp.net MVC 3, net framework 4.0