我想将 JSON 发布到控制器操作,并且我希望该操作将我引导到与 Ajax 响应不同的另一个视图:
JS:
geocoder.geocode(
{
'address': address
},
function (results, status) {
if (status == google.maps.GeocoderStatus.OK)
{
var o = { results: results };
var jsonT = JSON.stringify(o);
$.ajax({
url: '/Geocode/Index',
type: "POST",
dataType: 'json',
data: jsonT,
contentType: "application/json; charset=utf-8",
success: function (result) {
alert(result);
}
});
}
});
控制器 :
public ActionResult Index(GoogleGeoCodeResponse geoResponse)
{
string latitude = geoResponse.results[1].geometry.location.jb;
string longitude = geoResponse.results[1].geometry.location.kb;
...
return View("LatLong");
}