我的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);
}
});
});
Run Code Online (Sandbox Code Playgroud)
我的C#代码
public ActionResult SetMeeting(string ComputerName, DateTime? _mStart, DateTime? _mEnd)
{
}
Run Code Online (Sandbox Code Playgroud)
代码结束时未收到DateTime值.....它们只显示为空白.在jquery当我试图
'_mStart': now.toTimeString(),
'_mEnd': now.toDateString()
Run Code Online (Sandbox Code Playgroud)
到datetring确实返回今天的日期,但是,我也希望时间也是日期时间的一部分.