How does the second interface of promise use the data returned by the first interface?

the second interface uses the data returned by the first interface name , and then splices it without promise.all or global variables. Solve?

clipboard.png

function ajax(url,datas){
            return new Promise((resolve,reject) => {
                $.ajax({
                    url:url,
                    type:"post",
                    dataType:"json",
                    data:datas,
                    success:function(data){
                        resolve(data);
                    },
                    error:function(error){
                        reject(error);
                    }
                });
            });
        }

        ajax("data/data.json",{"name":"1"}).then((json) => {
            console.log(json);
            let name = json.bean;
            return ajax("data/data1.json",{"age":30,"name":json.bean},json.bean);
        }).then((data) => {
            console.log(data.bean + name);
        }).catch((error) => {
            console.log(error.returnMessage);
        });

revised

function ajax(url,datas){
            return new Promise((resolve,reject) => {
                $.ajax({
                    url:url,
                    type:"post",
                    dataType:"json",
                    data:datas,
                    success:function(data){
                        resolve(data);
                    },
                    error:function(error){
                        reject(error);
                    }
                });
            });
        }

        ajax("data/data.json",{"name":"1"}).then((json) => {
            let name = json.bean;
            let _ajax = ajax("data/data1.json",{"age":30,"name":json.bean});
            return{
                name:name,
                ajaxData:_ajax
            }
        }).then((data) => {
            data.ajaxData.then((v) => {
                console.log(data.name + v.bean);
            })
        }).catch((error) => {
            console.log(error.returnMessage);
        });
Sep.20,2021

let name = json.bean;
let _ajax = ajax('data/data1.json',{"age":30,"name":json.bean},json.bean);
return {
    name:name,
    ajaxData:_ajax
};

define name outside

let name = '';
ajax('data/data.json',{'name':"1"}).then((json) => {
    console.log(json);
    name = json.bean;
    return ajax('data/data1.json',{"age":30,"name":json.bean},json.bean);
}).then((data) => {
    console.log(data.bean + name);
}).catch((error) => {
    console.log(error.returnMessage);
});
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b30525-2bd1a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b30525-2bd1a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?