微信web网页背景颜色及promise与ajax合并

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/Thekingyu/article/details/83865949

微信背景默认不是白色需设置body

        const Proms = zhi => {
            console.log(param)
            return new Promise((resovle, reject) => {
                $.ajax({
                    "type": zhi.type || "get",
                    "async": zhi.async || true,
                    "url": zhi.url,
                    "data": zhi.data || "",
                    "success": res => {
                        resovle(res);
                    },
                    "error": err => {
                        reject(err);
                    }
                })
            })
        }

        let step = () => {
            Proms({
                "url": "http://47.99.195.63:8090/api/user/inviteIncomeRecord",
                "type": "get"
            }).then(res => {
                console.log("");
            }).catch(err => {
                console.log("");
            })
        }

        step()

   第一个请求
*/
let step1 = () => {
    ajaxPromise({
      "url":"",
    }).then(res => {
        console.log("第一个请求正确返回==>"+res);  
        step2(res);  
    }).catch(err => {
        console.log("第一个请求失败");  
    })
}

/*
   第二个请求
*/
let step2 = (res) => {
    ajaxPromise({
      "type":"get",
      "url":"",
      "data":{"name":res}
    }).then(res => {
        console.log("第二个请求正确返回==>"+res);  
    }).catch(err => {
        console.log("第二个请求失败==>"+err);  
    })
}

step1();

解决n个ajax传值问题,第二ajax需第一个ajax返回值,

猜你喜欢

转载自blog.csdn.net/Thekingyu/article/details/83865949