【问题标题】:json returned from a jsonresult in asp.net mvc从 asp.net mvc 中的 jsonresult 返回的 json
【发布时间】:2023-03-18 07:38:02
【问题描述】:

我从控制器的 json 结果返回这个,

 var genericResult = new { redirectUrl = Url.Action("Create", "Registration")
                                , isRedirect = true };
return Json(genericResult);

但是当我通过萤火虫检查时,

{"redirectUrl":"/","isRedirect":true}

       if (data.isRedirect) {
            window.location.href = json.redirectUrl;
        }

任何建议....如何重定向?

【问题讨论】:

    标签: jquery asp.net-mvc redirect jsonresult


    【解决方案1】:

    根据它的声明方式,将data 修复为json,或将json 修复为data

    【讨论】:

    • 没有值{"redirectUrl":"/"
    • 那你需要把json.redirectUrl改成data.redirectUrl
    猜你喜欢
    • 1970-01-01
    • 2011-03-08
    • 1970-01-01
    • 1970-01-01
    • 2011-08-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多