未执行Ajax重定向[重复]

This question already has answers here:
                </div>
            </div>
                    <div class="grid--cell mb0 mt4">
                        <a href="/questions/199099/how-to-manage-a-redirect-request-after-a-jquery-ajax-call" dir="ltr">How to manage a redirect request after a jQuery Ajax call</a>
                            <span class="question-originals-answer-count">
                                (32 answers)
                            </span>
                    </div>
            <div class="grid--cell mb0 mt8">Closed <span title="2014-10-14 20:26:29Z" class="relativetime">5 years ago</span>.</div>
        </div>
    </aside>

Data is persisting in table but after that page is not redirected to the specified destination.

Is redirection through ajax possible?

Please check the code and help me out

function foodLog(){
    var getDate = $('#ddBox').val();
    var stringDate = getDate;
    var newdate = stringDate.split("/").reverse().join("-");
    var data={ 
        servings : $('#demo_vertical').val(),
        calories : "12",
        carbs : $('#carbs').text(),
        carter : $('#carter').text(),
        cholestral : $('#cholestral').text(),
        date: newdate,  
        fiber : $('#fiber').text(),
        foodItem: $('#foodItem').text(),
        foodtype:$('#foodtype').text(),
        totalFat : $('#totalFat').text(),
        saturatedFat : $('#satFat').text(),
        sugar : $('#sugar').text(),
        protein: $('#protein').text(),
        size :$('#size').text(),
    };

    $.ajax({  
        type : "POST",   
        contentType: "application/json; charset=utf-8",
        url : "/fitbase/foodlog/create",
        dataType: "text",
        data : JSON.stringify(data),
        success : function(response) {

            if (response.redirect){
                console.log("Redirecting to page") 
                window.location.href = '/'; 
            }
        },
        error : function(e) {  
            alert("Object" +e);
        }  
    });  
};
</div>

I think window.location.href should contain the entire redirection url instead of '/' in your code.