如何在XMLHttpRequest中显示500内部服务器错误消息内容?下面提到的成功消息正常工作。但是当我给出if(xhr.status === 500){}时,它只是给出了" invalidText"响应为"内部服务器错误"。但无法获取控制台消息。请帮助我。
var me = this;
var fileInput = this.$.file;
me.formData = new FormData();
me.formData.append('filename', fileInput.files[0], fileInput.files[0].name);
var iframe = me.querySelector('paper-dialog').querySelector('iframe');
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function(e) {
if (xhr.readyState === 4 && xhr.status === 200) {
me.respPrvw = '/neon-ws/preview_' + e.target.response + '/index.html';
me.set('flgEdit', true);
me.loadHtml(me.respPrvw);
iframe.src = me.respPrvw;
}
};
xhr.open('POST', '/uploadFile', true);
xhr.send(me.formData);