ExtJS 4 - JsonStore + Post Request的问题

M00*_*0ly 5 javascript ajax json extjs extjs4

我正在尝试使用POST请求调用API.但我的Chrome Inspector会method='GET'在网络标签中显示我...

这是我的代码:

Ext.define('TestItem', {
        extend: 'Ext.data.Model',
        fields: [ 
            {name: 'id', type: 'int'},
            {name: 'name', type: 'string'}
    ]
    });

    var testStore = Ext.create('Ext.data.JsonStore', {
        model: 'TestItem',
        autoLoad: true,
        proxy: {
            type: 'ajax',
            url : '../path_to/api/',
            method : 'POST',
            reader: {
                type: 'json',
                root: 'data',
                totalProperty: 'total'
            }
        },
        baseParams: { 
            operation:'showall' 
        }
    });
Run Code Online (Sandbox Code Playgroud)

所以O想用API method='POST'和参数调用APIoperation = showall

Google Inspector会在网络标签中向我显示以下信息:

GET ../path_to/api/?_dc=1315297478131&page=1&start=0&limit=25 HTTP/1.1
Run Code Online (Sandbox Code Playgroud)

为什么是GET请求?

为什么有限制,启动和直流等参数?

我已经尝试了1000个教程并用Google搜索了一整夜.

Iva*_*van 17

在extjs4方法中:POST不起作用.在extjs4中,任何读取都由GET发送,任何写入(POST,PUT,DELETE)都由POST发送.要覆盖它,请参阅actionMethods.

type: 'ajax',
actionMethods: {
    create : 'POST',
    read   : 'POST',
    update : 'POST',
    destroy: 'POST'
}
Run Code Online (Sandbox Code Playgroud)