let massErrors=[];
if (Pass != '' && PassRepeat == Pass && Email != '' && Nik != '') {
$.ajax({
url: '../php/index.php',
method: 'POST',
dataType: 'json',
success: function (data) {
data.forEach(function (record) {
{
if (record.nik === Nik) {
massErrors.push("Errors ")
}
}
})
},
});
console.log(massErrors);
console.log(massErrors.length)
if(massErrors.length<0){
也许我听不懂,但是ajax是异步的,好像(massErrors)检查数据是否还没有到达?