【发布时间】:2013-05-28 14:43:32
【问题描述】:
我想通过 ajax 将数据从 dynatree 发布到我的 asp.net mvc 服务器。我使用来自 Steve 的模型类 (Dynatree with ASP.NET MVC),它们可以很好地从服务器获取数据到客户端。但是我仍然无法将树数据发布到服务器。
客户:
var td = $("#tree").dynatree("getTree").toDict();
var json = JSON.stringify(td);
$.ajax({
type: "POST",
url: "/parttree",
data: json,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
alert(response);
}
});
服务器:
[POST("/parttree")]
public ActionResult TreeData2( List<TreeItem> ot)
{
// ot is always null here
}
VS调试器中json的内容:
{"title":null,"key":"_1","isFolder":false,"isLazy":true,"tooltip":null,"href":null,"icon":null,"addClass":null ,"noLink":false,"activate":false,"focus":false,"expand":true,"select":false,"hideCheckbox":false,"unselectable":false,"children":[{"标题":"root","key":"_2","isFolder":false,"isLazy":false,"tooltip":null,"href":null,"icon":null,"addClass":null ,"noLink":false,"activate":false,"focus":false,"expand":false,"select":false,"hideCheckbox":false,"unselectable":false,"children":... .
【问题讨论】:
标签: javascript asp.net serialization dynatree