сделал аякс обдним большим обьектом но столкнулся с таков вот проблемой
если вот так, то алерт в хроме(только в хроме в других браузерах все четко) выдает 4 раза :
createXmlHttp : function () {
if (this.xmlHttp) return true;
try {
this.xmlHttp = new XMLHttpRequest();
} catch(e) {
try {
this.xmlHttp = new ActiveXObject('Microsoft.XMLHttp');
} catch(e) {
return false;
}
}
if (this.xmlHttp) return true;
},
xmlHttpRequest : function () {
if ((this.xmlHttp.readyState == 4) || (this.xmlHttp.readyState == 0)) {
this.xmlHttp.open(this.method, this.url, true);
this.xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
this.xmlHttp.onreadystatechange = this.query;
this.xmlHttp.send(this.value);
} else {
this.writehtml('AJAX Error : POTOK server ZANAT pleas retry');
}
return true;
},
query : function () {
if (this.readyState == 4) {
if (this.status == 200) {alert(1);
this.responseText;
} else {
//this.writeHtml('Error: ' + xmlhttp.statusText);
}
}
},
а если вот так, то в хроме один раз алерт бьет, ну в других разумеется тоже норма работает :
createXmlHttp : function () {
if (this.xmlHttp) return true;
try {
this.xmlHttp = new XMLHttpRequest();
} catch(e) {
try {
this.xmlHttp = new ActiveXObject('Microsoft.XMLHttp');
} catch(e) {
return false;
}
}
if (this.xmlHttp) return true;
},
xmlHttpRequest : function () {
xmlHttp = this.xmlHttp;
if ((xmlHttp.readyState == 4) || (xmlHttp.readyState == 0)) {
xmlHttp.open(this.method, this.url, true);
xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xmlHttp.onreadystatechange = this.query;
xmlHttp.send(this.value);
} else {
this.writehtml('AJAX Error : POTOK server ZANAT pleas retry');
}
return true;
},
query : function () {
if (xmlHttp.readyState == 4) {
if (xmlHttp.status == 200) {alert(1);
this.responseText;
} else {
//this.writeHtml('Error: ' + xmlhttp.statusText);
}
}
},
в че мпроблема? хочется с едлать как первый вариант, подскажите мою ошибку