Nagłówek Ajax / php: Lokalizacja

Mam modal Bootstrap z formularzem logowania Ajax. Wyświetlanie błędów i wszystko działa dobrze aż do wynikulogin.php jestheader('Location: index.php');

Obsługuję wynik w ten sposób:

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;
        }
    }

Problem polega na tym, że kiedy logowanie się powiedzie i otrzymujęheader('Location: index.php'); odpowiedźindex.php jest otwarty wdiv.status.

Czy istnieje łatwy sposób na przetłumaczenie nagłówka PHP na przekierowanie w javascript?

questionAnswers(2)

yourAnswerToTheQuestion