我有一系列通過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