Hi Adam,

How to easily get post data in php/zf if it's json instead of 'normal' query
string?
There are two possible solutions.

Either you let the server transform the json data using Zend_Json, reading it from the raw post body using the http request's getRawBody() method. I am not sure if there is a neater way to inject the JSON values into the request object (probably there is, someone else might elaborate on that). Second solution is make sure the content is posted using a regular POST with a application/x-www-form-urlencoded content type (the same way a regular POST form is sent). That should be fixed in your Dojo (or other client side) code.

It is a matter of taste what your preference is; however I always prefer handling forms with regular posts in ajax the same way I do without (which can save a lot of trouble getting your application non-js compatible, or have a working fallback if the JS somehow fails).

HTH,
Gerard

Reply via email to