我使用$ .ajax()每5秒轮询一次动作方法,如下所示:
$.ajax({
    type: 'GET', url: '/MyController/IsReady/1',
    dataType: 'json', success: function (xhr_data) {
        if (xhr_data.active == 'pending') {
            setTimeout(function () { ajaxRequest(); }, 5000);                  
        }
    }
});
和ActionResult动作:
public ActionResult IsReady(int id)
{
    if(true)
    {
        return RedirectToAction("AnotherAction");
    }
    return Json("pending");
}
我必须将动作返回类型更改为ActionResult才能使用RedirectToAction(最初它是JsonResult并且我正在返回Json(new { active = 'active' };),但它看起来很难重定向并从$ .ajax()成功回调中呈现新视图.我需要从这个轮询ajax回发中重定向到"AnotherAction".Firebug的响应是来自"AnotherAction"的视图,但它不是渲染.