Jquery 将JSON发布到asp.net MVC控制器,而不是Ajax

Jquery 将JSON发布到asp.net MVC控制器,而不是Ajax,jquery,ajax,asp.net-mvc,json,post,Jquery,Ajax,Asp.net Mvc,Json,Post,我想将JSON发布到控制器操作,并希望该操作将我引导到与Ajax响应不同的另一个视图: JS: 控制器: public ActionResult Index(GoogleGeoCodeResponse geoResponse) { string latitude = geoResponse.results[1].geometry.location.jb; string longitude = geoResponse.results[1].geometry.location

我想将JSON发布到控制器操作,并希望该操作将我引导到与Ajax响应不同的另一个视图:

JS:

控制器:

 public ActionResult Index(GoogleGeoCodeResponse geoResponse)
 {
     string latitude = geoResponse.results[1].geometry.location.jb;
     string longitude = geoResponse.results[1].geometry.location.kb;
     ...
     return View("LatLong");
 }

我很确定你不能用一个普通的请求发布JSON。如果您担心的是重定向,那么我建议继续使用ajax请求,并在success函数中处理重定向

$.ajax({ type: "POST", data: { }, dataType: "json", url: "Home/AjaxAction" })
    .success(function (data) {
        window.location = data.redirectUrl;
    });
和服务器代码

[HttpPost]
public JsonResult AjaxAction()
{
    // do processing
    return Json(new { redirectUrl = Url.Action("AnotherAction") });
}

public ActionResult AnotherAction()
{
    return View();
}

我很确定你不能用一个普通的请求发布JSON。如果您担心的是重定向,那么我建议继续使用ajax请求,并在success函数中处理重定向

$.ajax({ type: "POST", data: { }, dataType: "json", url: "Home/AjaxAction" })
    .success(function (data) {
        window.location = data.redirectUrl;
    });
和服务器代码

[HttpPost]
public JsonResult AjaxAction()
{
    // do processing
    return Json(new { redirectUrl = Url.Action("AnotherAction") });
}

public ActionResult AnotherAction()
{
    return View();
}