首页 > 解决方案 > 无法从“XMLHttpRequest”读取“responseText”属性

问题描述

使用以下存储从远程服务器加载列表

var store = Ext.create('Ext.data.Store', {
    model: 'MyAppName.view.home.OrderListViewModel',
    groupField: 'customer',
    proxy: {
        type: 'ajax',
        url: 'ordersList.php',
        reader: {
            type: 'json',
            rootProperty: 'orders',
            totalProperty: 'total'
        }
    },
    autoLoad: {
        params: {},
        callback: function (records, options, success) {
            if (success) {
                alert('here I am');
            }
        }
    }
});

它正确加载了列表,但查看 Chrome 控制台会出现错误

Uncaught DOMException: Failed to read the 'responseText' property from 'XMLHttpRequest': The value is only accessible if the object's 'responseType' is '' or 'text' (was 'json').

Nad 看着萤火虫就像仍在尝试加载列表。

GET fabricList.php?_dc=1579631906478&page=1&start=0&limit=25
Params Headers Response

store:Ext.create('Ext.data.Store',{})我在程序中使用的每一个都发生了同样的情况。我正在使用 ExtJS 版本 7.0.0.40 我将不胜感激在这件事上的任何帮助。谢谢

标签: extjsxmlhttprequestresponsetext

解决方案


可能此错误表明从您的端点fabricList.phpMDN返回的数据格式不正确。请发布从返回的数据fabricList.php并在此处检查Content-Type标题以作为响应


推荐阅读