Maxmaxmaximus7, мне нужно прочитать json файл.
сделал так
function HTTPError(obj) {
        if(!obj) return;
        if(obj.hasOwnProperty("code")
            && obj.hasOwnProperty("text")) {
            obj.text = this.messages[obj.code] || obj.text;
        }
        for(var key in obj){
            if(obj.hasOwnProperty(key))
                this[key] = obj[key];
        }
    };
    HTTPError.prototype.messages = Object.create({
        "404": "Страница не найдена"
    });
pages.prototype.getFile = function(src, onload, onerror) {
      var xhr = new XMLHttpRequest();
          xhr._src = src;
          xhr.onreadystatechange = function(e){
              if(this.readyState != 4) return;
              if(xhr.status == 200) {
                  return onload.call(this, e);
              }
              onerror.call(this, new HTTPError({
                  text: this.statusText,
                  code: this.status,
                  object: this
              }), e);
          };
          xhr.open("GET", src);
          xhr.send(null);
      return xhr;
    };