I have an ASP.NET MVC controller action with the following VB.NET signature:
<HttpPost()>
Public Function ClosestCities
(ByVal position As MapCoordinate, ByVal citiesCount As UInteger) As JsonResult
The MapCordinate
class is:
Public Class MapCoordinate
Public Latitude As Double
Public Longitude As Double
End Class
If I'm trying to send an Ajax POST in jQuery to the ClosestCities
action, what should my request look like?
When I use the following code to POST to this action, in the debugger window of VS, position.longitiude
and position.latitude
are equal to 0.0
(0D
):
$.post("/geodata/closest-cities", {
position: {
Longitude: mapPosition.lng(),
Latitude: mapPosition.lat()
},
citiesCount: 5
}, function (cities) {
debugger;
});