Ajax / php header: Localização

Eu tenho um modal Bootstrap com um formulário de login do Ajax. Exibindo erros e tudo funciona bem até o resultadologin.php éheader('Location: index.php');

Eu manuseio o resultado assim:

var hr = new XMLHttpRequest();
    // Set content type header information for sending url encoded variables in the request
    hr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    // Access the onreadystatechange event for the XMLHttpRequest object
    hr.onreadystatechange = function() {
        if(hr.readyState == 4 && hr.status == 200) {
            var return_data = hr.responseText;
            document.getElementById("status").innerHTML = return_data;
        }
    }

O problema é que quando o login é bem sucedido e eu recebo oheader('Location: index.php'); respostaindex.php é aberto emdiv.status.

Existe uma maneira fácil de traduzir o cabeçalho PHP para um redirecionamento em javascript?

questionAnswers(2)

yourAnswerToTheQuestion