【发布时间】:2011-08-29 22:28:29
【问题描述】:
我的 Ajax 调用
$('#QuickReserve').click(function () {
var now = new Date();
alert(now);
var _data = {
'ComputerName': _computerName,
'_mStart': now.toTimeString(),
'_mEnd': now.toDateString()
};
$.ajax({
cache: false,
// contentType: "application/json; charset=utf-8",
type: "POST",
async: false,
url: "/Home/SetMeeting",
dataType: "json",
data: _data,
success: "",
error: function (xhr) {
alert("Error");
alert(xhr.responseText);
}
});
});
我的 C# 代码
public ActionResult SetMeeting(string ComputerName, DateTime? _mStart, DateTime? _mEnd)
{
}
代码结束时未收到日期时间值.....它们只是显示为空白。 当我尝试在 jquery 中
'_mStart': now.toTimeString(),
'_mEnd': now.toDateString()
to datestring 确实返回今天的日期,但是,我也想要日期时间的时间部分。
【问题讨论】:
-
您应该尝试接受字符串而不是日期时间,然后再将字符串解析为日期。这个问题可能只是一个解析问题
标签: c# asp.net-mvc asp.net-mvc-3 jquery