我想将复杂数据从jquery发送到mvc控制器,后者存储在本地存储中 在控制器中我能够获得记录,也获得categoryid值,但是taxyear数据为空。
public class ReviewOrder
{
public long CategoryId { get; set; }
public TaxYear taxyear { get; set; }
}
public ActionResult ReviewOrder(List<ReviewOrder> storedTaxyear)
{
CategoryPrice categoryPrice = new CategoryPrice();
// IEnumerable<VMCategoryPriceDescription> ServicesCategoryList = categoryPrice.GetCategoryPriceDescription(CategoryID);
// List<ReviewOrder> data = JsonConvert.DeserializeObject<List<ReviewOrder>>(taxyearObj);
return PartialView("_ReviewOrder");
}
Jquery Code
var taxyearObj = [];
if (localStorage.taxyear) {
var storedTaxyear = JSON.parse(localStorage.getItem("taxyear"));
debugger
$.ajax({
url: '@Url.Action("ReviewOrder", "Tax" )',
type: 'GET',
dataType: "json",
traditional: true,
contentType: "application/json; charset=utf-8",
data: ({storedTaxyear:storedTaxyear }),
success: function(result) {
}
});
JSON对象
[
{
CategoryId :1,
taxyear: [{taxyearid:1,teaxyeardesc:lorepipsum}]
}]