I have en array that looks like this:
[Object { OldData="(3) Lindrigt skadad", NewData="(9) Uppgift saknas", AccidentNumber=1173590}]
I make a Jquery-post as below to ASP.NET:
$.ajax({
type: "POST",
url: DataReview.BASE + "/UOS/SaveUOSChangeLog",
data: postData,
success: function (data) {
//alert(data.Result);
},
dataType: "json",
traditional: true
});
Here Is my controller:
public ActionResult SaveUOSChangeLog(List<String> values)
{
try
{
var fish = Json(new { Data = values });
return Json(new { Result = "True", ResultData = values }, JsonRequestBehavior.AllowGet);
}
catch(Exception e)
{
return Json(new { Result = "Fail", Message = "Faaaaaail" }, JsonRequestBehavior.AllowGet);
}
}
When I debug this, the value of values is [0] = "[object Object]"
How can I access the actually values from the array?
EDIT:
I have created the following model:
public class UOSChangeLogFrontEnd
{
public int AccidentNumber { get; set; }
public string OldData { get; set; }
public string NewData { get; set; }
public int Action { get; set; }
}
An my controller looks like this:
public ActionResult SaveUOSChangeLog(List<UOSChangeLogFrontEnd> values)
{
try
{
var fish = Json(new { Data = values });
return Json(new { Result = "True", ResultData = values }, JsonRequestBehavior.AllowGet);
}
catch(Exception e)
{
return Json(new { Result = "Fail", Message = "Faaaaaail" }, JsonRequestBehavior.AllowGet);
}
}
But the value count Is 0 when I debug.