次のアクションがあります。
public JsonResult GetGridCell(double longitude, double latitude)
{
var cell = new GridCellViewModel { X = (int)Math.Round(longitude.Value, 0), Y = (int)Math.Round(latitude.Value, 0) };
return Json(cell);
}
次のjqueryで呼び出しています:
$.post('Grid/GetGridCell', { longitude: location.longitude, latitude: location.latitude },
function (data) {
InsertGridCellInfo(data);
});
私の GetGridCell アクションのパラメーターは入力されません (null です)。デバッグすると、 Request.Form[0] が経度と呼ばれ、正しい値を持っていることがわかります。緯度についても同様です。
まったく同じコードを使用すると、$.get
すべて正常に動作します。
私は何を間違っていますか?