У меня есть следующий код:
sendRequest : function(data){
var me = this;
this._createData(data);
try{
this.req.open(this.method,this.page,true);
this.req.onreadystatechange=function()
{
if (this.readyState==4 && this.status==200)
{
if(this.responseText)
var response = eval('(' + this.responseText + ')');
else
response = null;
me.callBack(response);
return false;
}
}
this.req.send(this.data);
} catch(err){
me.callBack(response);
}
},
Он работает нормально и возвращает то, что, как я ожидаю, вернется, но когда соединение потеряно, оно не переходит в блок catch. Я хочу знать, как перехватить запрос, когда страница сервера недоступна.