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