Home  >  Q&A  >  body text

After logging in to the api interface to obtain data, switching pages shows that you are not logged in.

function Property() {
var xmlhttp;
if (window.XMLHttpRequest) {
xmlhttp = new XMLHttpRequest();
} else {
xmlhttp = new ActiveXObject("Microsoft .XMLHTTP");
}

xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
var datastr = xmlhttp .responseText;
alert(datastr);
var dataobj = JSON.parse(datastr)
let dataarr = [];
for (let i in dataobj) {
dataarr.push( dataobj[i]);
}

 
}
}

xmlhttp.open("POST", "https://api.123321yun.com/api /device/queryProjectDeviceParamStatus?projId=66", true);

/* xmlhttp.open("POST", "https://api.123321yun.com/api/user/login?username=test123&password= 123456", true);*/ xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlhttp.send();
}

Xiaobai wants to solve the problem that the login status cannot be saved

胡行东胡行东2030 days ago1579

reply all(2)I'll reply

  • 秋香姐家的小书童

    秋香姐家的小书童2019-03-31 11:46:00

    The server provider's SESSION is not saved


    You can use AJAX to determine whether the user's SESSION exists in the server. If there is, it will be logged in. If not, it will prompt login

    reply
    1
  • Cancelreply