SOURCE

function foo(){
  return  new Promise(
    function(resolve,reject){
      $.ajax({
          url:"http://wthrcdn.etouch.cn/weather_mini?city=北京市",    
          dataType:"json",  
          data:'',    
          type:"GET",   
          success:function(req){
              // console.log(11,req)
              resolve(req);
          },
          error:function(){
              reject();
          }
      });
    }
  )
}
function foo1(){
  console.log('foo1')
  return new Promise(
    $.ajax({
        url:"http://wthrcdn.etouch.cn/weather_mini?city=北京市",    
        dataType:"json",   
        data:'',    
        type:"GET",  
        success:function(req){
            console.log(1111,req)
             resolve(req);
        },
        error:function(){
            reject();
        }
    });
  )
}
// async function bar(){
//   setTimeout(function a(){
//       console.log(22)
//   },5000)
// }
// async function bar1(){
//   await new Promise(resolve => {
//     setTimeout( resolve, 3000);
//   });
// }
// async function x(){
//   await foo1();
//   await foo();
//   return '2222'
// }
foo()

// bar();
console 命令行工具 X clear

                    
>
console