The past impression of the Ajax asynchronous operation, has been incredibly in the $.ajax function inside the asynchronous, is really wrong, the actual asynchronous operation, is for the entire JS file.
Today I finally realized that the actual situation was as follows:
$ (function () {
//"box cue layer" Initialize
$.like.initalertmsgdiv ();
Determine if the account creates a wallet
isexistwallet ();
Wallet Information Display
showwalletinfo ();
Load Recent Transactions
Pageclick (1, 3);
First determine whether the account created a wallet, not created, in time to create an empty wallet. The next step is to load the information in the wallet.
There is a wallet non-null validation in the Load Wallet information function. At first, the Ajax operation in the Isexistwallet () function was asynchronous, resulting in the absence of the wallet and the creation of the purse, which was performed to report the wallet as an empty error.
So at this point Ajax should be changed to synchronous operation, to determine whether the account created wallet code as follows:
function Isexistwallet () {
//ajax query
$.ajax ({
URL: $.like.getrooturl () + "/wallet/isexistwallet.htm",
type: "POST",
data: {
"type": Type
},
DataType: "JSON",
Async:false,
success:function (data) {
var res = data.res;
var msg = data.msg;
if (res==2) {//Login timeout
$.like.alert_msg (MSG, 1, $.like.getrooturl () + '/agent/home.html ');
} else if (res!=0) {
$.like.alert_msg (Msg, 0, ');}
}
);
}
Async:false can get it done.