SOURCE

var myNewAjax = function(url) {
  return new Promise(function(resolve,reject) {
    var xhr = new XMLHttpRequest();
    xhr.open('get',url);
    xhr.send(data);
    xhr.onreadystatechange = function() {
      if(xhr.readyState == 4 && xhr.status == 200){
				var json = JSON.parse(xhr.responseText);
        resolve(json);
      }else {
        reject('error');
      }
      
    }
  });
}
console 命令行工具 X clear

                    
>
console