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
Grade MapCordinate
:
Public Class MapCoordinate
Public Latitude As Double
Public Longitude As Double
End Class
If I try to send an AJAX POST in jQuery to an action ClosestCities
, what should my request look like?
When I use the following code for POST for this action, the VS debugger window, position.longitiude
and position.latitude
equal 0.0
( 0D
):
$.post("/geodata/closest-cities", {
position: {
Longitude: mapPosition.lng(),
Latitude: mapPosition.lat()
},
citiesCount: 5
}, function (cities) {
debugger;
});
source
share