PDA

View Full Version : Store proxy ajax send post data



whisher
14 Jan 2012, 9:55 AM
Hi,
I'm following MVC application getting startes doc
fitting it to a really working case I'm stuck to send post
data can you help me, please ?
in app/store


Ext.define('SA.store.Users', {
extend: 'Ext.data.Store',
model: 'SA.model.User',
autoLoad: true,
proxy: {
type: 'ajax',
actionMethods: {
read : 'POST',
update : 'POST'
},
api: {
read: 'user/list',
update: 'user/update'
},
reader: {
type: 'json',
root: 'users',
successProperty: 'success'
}
}
});

kskrumpet
14 Jan 2012, 12:56 PM
The use of actionMethods works for me (in that the request is a POST request) - you'll need to supply a bit more information - which version of ExtJS, maybe supply a screenshot of firebug showing the request as a GET.

whisher
15 Jan 2012, 3:31 AM
Thanks for the reply.
It's very strange in the firebug there are data
30717

but if I check in the action like that


var_dump($_REQUEST);exit;


I got


array
'_dc' => string '1326626445947' (length=13)
'PHPSESSID' => string '41cb61460b04c6560cd135225451381c' (length=32)



I'm using ext-4.0.7-gpl

:s

kskrumpet
15 Jan 2012, 4:00 AM
Ignore last comment - I don't use PHP a lot (and should have read further down the page I linked you to) ;)

In any case - it may be that the content of the request isn't what PHP expects - I found this with a quick Google search:
http://satyam.com.ar/yui/2.5.0/JSONsend.php

Rich

whisher
15 Jan 2012, 4:08 AM
Ignore last comment - I don't use PHP a lot (and should have read further down the page I linked you to) ;)

In any case - it may be that the content of the request isn't what PHP expects - I found this with a quick Google search:
http://satyam.com.ar/yui/2.5.0/JSONsend.php

Rich

I use php just a lot :) in the superglobal $_REQUEST contains the content of both $_GET, $_COOKIE, and $_POST so ......

kskrumpet
15 Jan 2012, 4:26 AM
Ok, but I don't think PHP is interpretting the pure json content that ExtJS is sending, expecting the traditional "form data" format, so... Just search for "php post json" in google. This isn't an ExtJS problem IMO.

whisher
15 Jan 2012, 4:40 AM
Ok, sorry you right I use php just a lot but never with json data via POST :">
(btw strange behavior ) your link works ! thanks a lot !

I believe I'm getting an empty array because PHP is expecting
the posted data to be in a Querystring format (key=value&key1=value1)