Home > Mobile >  Wx. Request the function calls the callback function on page for page data calls in question?
Wx. Request the function calls the callback function on page for page data calls in question?

Time:04-19

Zhuce: function () {
let that=this;
If (that) data. The username. Length==0 | | that. The data. The password. The length==0 | | that. The data. The password=="" | | that. Data. The password==" ") {
Wx. ShowModal ({
Title: 'account or password cannot be empty! '
})
} else if (that data. The username. Length & lt; 10) {
Wx. ShowModal ({
Title: 'account number format is not correct! '
})
} else if (that data. The password. Length & lt; 6) {
Wx. ShowModal ({
Title: 'password figures may not be less than 6! '
})
} else {
The console. The log (" Hello, users: "+ this. Data. The username +" \ npassword: "+ this. Data. The password).
Wx. Request ({
Url: 'http://localhost:8088/demo/User/ListByStuNo',
Method: 'GET',
Header: {
'the content-type' : 'application/x - WWW - form - urlencoded'
},
Data: {
'stuNo: this data. The username,
},
Success: the function (res) {
The console. The log (" is the callback function: "+ res. Data);
Var ResData=https://bbs.csdn.net/topics/res.data;
If (ResData=true) https://bbs.csdn.net/topics/={

Wx. ShowModal ({
Title: 'user already exists! '
Duration: 2000
})
} else {
Wx. Request ({
Url: 'http://localhost:8088/demo/User/register',
Method: "POST",
Header: {
'the content-type' : 'application/x - WWW - form - urlencoded'
},
Data: {
'stuNo: that data. The username,
"PassWord" : that. Data. The passWord
},
Success: the function (res) {
The console. The log (" is the callback function: "+ res. Data);
Var ResData=https://bbs.csdn.net/topics/res.data;
If (ResData=true) https://bbs.csdn.net/topics/={
Wx. ShowModal ({
Title: 'registered success! '
Duration: 2000
})
Wx. RedirectTo ({
url: '../denglu/denglu ',
})
} else {
Wx. ShowModal ({
Title: 'registration failed! '
Duration: 2000
})
}
}
})
}
}
})
}
},


This is a registered module, to determine whether a user is returned to a callback function, in the judgment of the callback function to continue to register, but appeared a callback function cannot be carried out on the page page of data calls, everyone said that the success is a closure, this point is different, in advance is assigned to that don't work, could you tell me how to solve, predecessors this should
  • Related