javascript - fetch 可以同步请求数据吗?
PHPz
PHPz 2017-04-11 11:13:55
0
3
1351

fetch(userLoginUrl, {

            method: 'POST',
            headers: {
                'Content-Type': 'application/json;charset=UTF-8'
            },
            body: JSON.stringify(userObj),
        }).then(function (res) {
            if (res.ok) {
                res.json().then(function (data) {
                    //console.log(data);
                    if (data.code == 0) {
                        dataTest = data;
                        dataBu = true;
                        applyFn(data);
                        //上面成功后再次出一个请求 ????
                    }

                });
            }
        }).catch(function (err) {
            // console.log(err)
        });
        
PHPz
PHPz

学习是最好的投资!

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!