I have a login page in html and i have used a Js function to call the api. The code is
function submitdetails() {
var username = document.getElementById("username").value;
var password = document.getElementById("password").value;
var params = JSON.stringify({ username: username, password: password });
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == XMLHttpRequest.DONE ) {
if (xmlhttp.status == 200){
if(xmlhttp.responseText == "AdminLogin"){
// Redirect Url to Ldap Configuration settings page
window.location.href = "Configure.html";
}else{
var cook = document.cookie;
document.getElementById("login_form").innerHTML = xmlhttp.responseText;
//document.getElementById("login_form").innerHTML = cook
}
}
else{
document.getElementById("login_form").innerHTML = "Error";
}
}
};
xmlhttp.open("POST","http://127.0.0.1:8000/login/",true);
xmlhttp.send(params);
}
The above code works perfectly fine in IE . But when i try it in Chrome , the fucntion return's to "else statement" which returns error in it.