![](/img/trans.png)
[英]Attaching jsondata to the call of loading a jsonstore in Extjs via POST request
[英]ExtJS 4 - Problems with JsonStore + Post Request
我正在嘗試使用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'
}
});
因此,O想要使用method='POST'
和參數operation = showall
來調用API
Google Inspector會在網絡標簽中向我顯示以下信息:
GET ../path_to/api/?_dc=1315297478131&page=1&start=0&limit=25 HTTP/1.1
為什么是GET請求?
為什么有限制,啟動和直流等參數?
我已經嘗試了1000個教程並用Google搜索了一整夜。
在extjs4方法中:POST不起作用。 在extjs4中,任何讀取都由GET發送,任何寫入(POST,PUT,DELETE)都由POST發送。 要覆蓋它,請參閱actionMethods。
type: 'ajax',
actionMethods: {
create : 'POST',
read : 'POST',
update : 'POST',
destroy: 'POST'
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.