function httpget(url){
return new Promise(function(resolve, reject){
var xhr = new XMLHttpRequest();
xhr.onload = function(){ (xhr.status>=200&&xhr.status<300) ? resolve(xhr.responseText) : reject(xhr); };
xhr.onerror = function(){ reject(xhr) };
xhr.open("GET", url, true);
xhr.send();
});
}
httpget('/getcurrentuserid')
.then(data=>{ return httpget('getuserinfobyid?id='+encodeURIComponent(data)); })
.then(data=>{ console.log(data); })
.catch(xhr=>{console.log(xhr.readyState+" "+xhr.status+" "+xhr.statusText);});