我有以下控制器操作:
public ActionResult AjaxQuantity(int productId = 0, double quantity = 0d, int periodId = 0)
{
...
}
和适当的ajax请求:
function Quantity(productId, quantity, periodId) {
$.ajax({
url: "@(Url.Action("AjaxQuantity"))",
cache: false,
type: "GET",
data: { productId: productId, quantity: quantity, periodId: periodId },
error: function () {
Server503();
}
});
};
此外,使用逗号作为小数分隔符的区域性。
例如,当我使用“12,34”作为数量进行 ajax 请求时,在控制器操作中我得到的数量为 1234d。
如果我将 ajax 请求的类型更改为“POST”,那么我会在操作中获得所需的数量为 12,34d。
GET 请求发生了什么?看起来就像在未使用的 GET 请求文化中一样(逗号很简单)。