我有一系列通过jQuery Ajax传递给MVC JsonResult操作的参数。在大多数情况下,这些成功到达,但有一个日期值根本没有到达。传递给MVC的JSON日期参数操作始终为空
我需要使用哪些考虑因素/格式 - 或者需要采取哪些方法 - 才能使此日期成功到达?
...other code ...
myStory.Deadline = new Date($('#story-deadline').val());
$.ajax({
url: '/Project/' + action[2] + '/AddStory',
data: { Summary: myStory.Summary, Size: myStory.Size, Priority: myStory.Priority,
Owner: myStory.Owner, Deadline: myStory.Deadline },
dataType: 'json',
traditional: true,
type: 'POST',
...the rest of the code...
的JsonResult动作:
[HttpPost]
public JsonResult AddStory(int projectid, Story story)
{
...some code that doesn't have a DateTime object to work with...
我试过原有的格式建议和更新之一,双方还没有到齐为空两者。他们被正确发布,但:截止日期\t“/ Date(1283169600000)/” – 2010-08-27 12:00:19
似乎应该用MVC的源代码测试问题(请参阅http://weblogs.asp.net/jacqueseloff/archive/2010 /04/20/mvc-2-source-code-released-to-microsoft-reference-server.aspx和http://aspnet.codeplex.com/releases/view/41742)。如果你有任何结果,请告诉我。 – Oleg 2010-08-27 14:28:57
它只适用于我手动序列化数据为json的情况。 ** data:JSON.stringify(params),** – vsapiha 2012-02-20 14:07:21