【发布时间】:2013-12-17 09:59:40
【问题描述】:
我有以下来自 jquery 的 ajax 调用代码。
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: oAxn.ds,
data: JSON.stringify(oAxn.p(graphsDrpDwn)),
beforeSend: function () {
$(".errorMsg").hide();
YC.toggleLoadingImg(tabId, false);
},
success: function (graphData) {
if (typeof oAxn.s === "function") {
if (graphData.reportData.ErrorMsg !== "Success") {
$(".errorMsg").show().html(graphData.reportData.ErrorMsg);
$("#tabs").hide();
YC.toggleLoadingImg(tabId, true);
} else {
//Inorder to avoid flicker, we hide in style sheet on page load.
$("#tabs").show();
$(".lblDrp").show();
$("#MainDiv").show();
YC.showRangeSel();
YC.toggleLoadingImg(tabId, true);
oAxn.s(graphData, grphOneID, grphTwoID);
}
}
},
error: function (err) {
YC.toggleLoadingImg(tabId, true);
}
});
获取参数JSON.stringify(oAxn.p(graphsDrpDwn))的方法是:
getDealerParams: function (graphsDrpDwn) {
/// <summary>We gather the parameters required for dealer tab</summary>
/// <param name="graphsDrpDwn" type="string">Holds the dropdown list id</param>
return {
//We get these from hidden inputs, since they won't be available
// in the query string for framed in reports
shopId: $(".txtShopId").val(),
siteId: $("." + graphsDrpDwn).find(":selected").attr("data-field"),
dealerId: $("." + graphsDrpDwn).find(":selected").val(),
frmDate: $(".tsFrom").val(),
toDate: $(".tsTo").val()
};
},
除frmDate、toDate 外,所有参数都在获取值。 我可以看到客户端的值,但是当传递给控制器时,两个总是空的。 它只发生在我的系统中,在我同事的机器上运行良好。 有人可以建议这里可能出了什么问题吗?
【问题讨论】:
-
由于问题出在日期字段且仅在某些机器上,可能是日期字段和/或区域性的默认设置之间存在差异,导致无法正确解析日期.尝试使用月份和日期都小于 13 的日期,看看它们是否有效。
-
是的...当两者都小于 13 时,它确实有效。我在哪里可以更改设置以允许 mm dd?
标签: asp.net-mvc-3 jquery