var firstNum,secendNum;// defines global variables
function first(){
$.ajax({
type:"POST",
async:false,
url:"http://120.132.230.256:8888/wallet/tran",
data:data,
success:function(data){
if(data.code==1){
firstNum=data.info;
}
}
});
return firstNum;//firstNum, "useId10086"
}
function secend(){
console.log(":"+firstNum);// "useId10086"
$.ajax({
type:"GET",
async:false,
url:url,
data:{id:firstNum},//firstNum,
//{id:"useId10086"}
//{id:firstNum}
//:{id:firstNum}
success:function(data){
if(data.code==1){
console.log(data);
secendNum = data.info.name;
}
}
});
return secendNum;
}
first();
secend();
//
console.log(firstNum);// "useId10086"
console.log(secendNum);//
how can I achieve the result in the first () method and pass the value to the secend () request to get the data I want.
I hope all of you will answer your doubts and be very grateful!