neden kaynaklanabilir ? kodlar kısaca :
function chatSession(){
this.getXmlHttpRequestObject = function() {
if (window.XMLHttpRequest) {
return new XMLHttpRequest();
} else if(window.ActiveXObject) {
return new ActiveXObject("Microsoft.XMLHTTP");
} else {
document.getElementById('p_status').innerHTML = 'eror, errorr, errrrrorrrrrr!!.';
}
}
this.sendReq = this.getXmlHttpRequestObject();
this.receiveReq = this.getXmlHttpRequestObject();
//sayfa yüklenince çalışan fonksiyon
this.startChat = function() {
//Set the focus to the Message Box.
document.getElementById('txt_message').focus();
//Start Recieving Messages.
this.getChatText();
}
//problem yaratan fonksiyon
this.getChatText = function() {
if (this.receiveReq.readyState == 4 || this.receiveReq.readyState == 0) {
this.receiveReq.open("GET", 'getChat.php?chat=1&last=' + this.lastMessage, true);
alert('getcharText ici receiveReq: ' + this.receiveReq + 'this.receiveReq.readyState: ' + this.receiveReq.readyState);
// bu alert düzgün sonuç veriyor (xmlhttpobject)
this.receiveReq.onreadystatechange = function(){
// bu alert undefined veriyor :(
alert('readystate ici receiveReq: ' + this.receiveReq);
alert('getChatText readystate' + this.sendReq.readyState);
// console.log(httpRequest.readyState);
if (this.receiveReq.readyState == 4) {
alert('getChatText if ici readystate' + this.receiveReq.readyState);
this.handleSendChat(this.receiveReq);
}
};
this.receiveReq.send(null);
// alert('np getChatText');
}
// else {alert('ajax eror');}
}
}