Answer the question
In order to leave comments, you need to log in
Why doesn't readyState fire over https?
function Auth(){
div_status = document.getElementById('status_auth');
login = document.getElementById('login');
pass = document.getElementById('pass');
div_status.innerHTML = '';
if( login.value != ''){
if( pass.value != '' ){
xhr = new XMLHttpRequest();
xhr.open("POST","ajax/login.php",true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.send("login="+login.value+"&pass="+pass.value);
if( xhr.readyState != 4 ){
div_status.innerHTML = 'Подождите пожалуйста';
}
xhr.onreadystatechange = function() {
if( xhr.statusText == 'OK' ){
console.log(xhr);
json_data = JSON.parse(xhr.responseText);
div_status.innerHTML = json_data.statusx;
}
}
}else div_status.innerHTML = 'Введите пароль!';
}else div_status.innerHTML = 'Введите логин!';
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question