PDA

View Full Version : Unify Ajax requests and Model Proxy requests.



iamcam
29 Jun 2011, 9:55 PM
I guess this might be the place to do this...

I'm working on the mobile end of a work in progress API and found some rather frustrating aspects of how data is sent to a server. With a "manual" AJAX request you can pretty much send data to the server in any format you wish, such as a JSON object ... even nested! However if you're requesting data via a model proxy, the best you can do is a flat key1=value1&key2=value2 set of parameters. The proxy request will be URL encoded (even encoded JSON), but you can't actually send just the encoded JSON object in the request payload like the Ext.Ajax.request().

It would be really helpful to unify the various parameter params. I've seen params:, extraParams:, and jsonData: all do similar things, but only apply in some cases. Ideally I would like the option to treat everything like jsonData and have the whole request and parameters sent on as {key1: "value1", key2: "value2", ...}. Even furthermore, it would be very helpful if we could optionally create a "request root" so we can throw all the data under a root param: {rootParam: {key1:value, key2:value}}. Ok, maybe this last part isn't as necessary, but it's something I'm dealing with as I talk to the API team.

Sorry for the brain dump - I've been thinking about this and trying to figure it out for a few days now and I finally figured out what I think needed to be requested.