Ошибка: Uncaught TypeError: Cannot read property 'readyState' of undefined в строчке
if(this.xhr.readyState == 4) {
function ajax(callback) { //json object
this.xhr;
this.result = {"result":"empty"};
this.send = function(addr, string, method, async){
this.xhr = new XMLHttpRequest();
this.xhr.open(method,addr,async);
if(method == 'POST') this.xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
this.xhr.send(string);
this.xhr.onreadystatechange = this.get;
}
this.get = function(){
if(this.xhr.readyState == 4) {
this.result = JSON.parse(this.xhr.responseText);
if(this.result.status == 'complete') {
if(!(callback === null)) {callback}
}
if(this.result.status == 'error') {
return showMsg(1,this.result.error);
}
}
}
}