如何从 jQuery 调用控制器操作?

How do I call a controller action from jQuery?

为什么 Confirm 视图在 ajax 调用成功后没有加载?我可以看到 "success" 警报, 进入控制器操作代码(在调试模式下)并查看正确的 id 值。

        // send nonce and verification data to your server

        var nonce = payload.nonce;

          $.ajax({
            type: "POST",
            url: '/store/confirm/',
            data: { id: nonce },
            success: function(data) {
                alert('success');
            }
        });

成功调用控制器操作:

public class StoreController : Controller
{
    public ActionResult Confirm(string id)
    {
        return View(); // this view never display on browser!
    }
}       

使用以下代码:

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

[HttpPost]
public ActionResult Confirm(string id)
{
    return Json(new { redirectToUrl = "/store/Confirm" });
}

Ajax:

$.ajax({
        type: "POST",
        url: '/store/confirm/',
        data: { id: nonce },
        success: function (response) {
            window.location.href = response.redirectToUrl;
        }
    });