I am trying to remove a div from my page once i receive an XMPHttpRequest response. I have also tried setting the display of the div to none using: document.getElementById('password').style.display = 'none'; but that didnt work either.
HTML:
Javascript Function:
function sendLoginInfo() {
var loginRequest = new XMLHttpRequest();
loginRequest.open("POST", "server/login.php", false);
loginRequest.setRequestHeader('Content-type', "application/json");
loginRequest.onreadystatechange = function () {
if(loginRequest.readyState == 4 && loginRequest.status == 200) {
sessionID = keyRequest.responseText;
var el = document.getElementById( 'password' );
el.parentNode.removeChild( el );
}
}
loginRequest.send(JSON.stringify(JSONFormData));
}
Update
This problem was solved by changing:
To: