내 ajax 함수 내에서 this.chkOK를 설정할 수없는 것처럼 보입니다. 나는 일종의 솔직한 일이 어떻게 이렇게 나는 validateFields.call (this)이 내 문제를 해결해야한다고 생각하지만 그렇게하는 경우에 대해 알게되었다. 그래서 저는 다음 단계를 위해 무엇을해야할지 모릅니다. 내가하지 않으면 이것을 전역 변수로 설정하고 싶지 않습니다. 이걸 설정하려고합니다 .chkOK = true변수를 외부 함수로 설정할 수 없습니다.
function validateFields() {
this.chkOK = null;
this.username = function() {
if(FS.gID('username').value.length >= 2) {
var user = FS.gID('username').value;
//Make sure that the username doesn't already exist
FS.ajax('/server/chkUser.php?user='+user,'GET',function(){
validateFields.call(this);
if(xmlText == 0) {
this.chkOK = true;
alert("This user doesn't exist.");
}
else if(xmlText == 1) {
alert("Theres already a user with this username");
this.chkOK = false;
}
});
}
else {
alert("empty");
this.chkOK = false;
}
alert(this.chkOK);
}
}
자신 만의 코드와이를 보는 다른 사람들의 코드를 모두 들여 쓰거나내어 쓰기해야합니다. –