I'm trying to call a API with a POST request. But my Chrome Inspector shows me method='GET'
in the network tab...
Here's my code:
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'
}
});
So O want to call the API with method='POST'
and the parameter operation = showall
The Google Inspector shows me in the network tab the following information:
GET ../path_to/api/?_dc=1315297478131&page=1&start=0&limit=25 HTTP/1.1
Why is it a GET request?
Why are there some parameters like limit, start and dc?
I already tried 1000 tutorials and googled the whole night.
In extjs4 method: POST does not work. In extjs4 any read is send by GET and any write (POST, PUT, DELETE) is send by POST. To override this see actionMethods.
type: 'ajax',
actionMethods: {
create : 'POST',
read : 'POST',
update : 'POST',
destroy: 'POST'
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With