I have the following action:
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);
}
I'm calling it with the following jquery:
$.post('Grid/GetGridCell', { longitude: location.longitude, latitude: location.latitude },
function (data) {
InsertGridCellInfo(data);
});
The parameters in my GetGridCell action are never filled (they are null). When debugging I can see that my Request.Form[0] is called longitude and has the correct value. Same goes for latitude.
When I use the exact same code, but with a $.get
everything works fine.
What am I doing wrong?