Hi,
> Since I work with prototypejs AJAX requests to return, I always return
> calls as application/json parsing the JSON object in the response, so
> I had to always use something like the following to use the object:
>
> var json = transport.responseText.evalJSON();
There's no need to do that. Just use the transport.responseJSON
property. Prototype detects application/json responses, automatically
evaluating the JSON and populating that property with it. Calling
transport.responseText.evalJSON() just duplicates that effort.
> However in the documentation of prototype, to use the JSON object
> directly, they recommend using, for example:
>
> var json = transport.headerJSON;
>
> To proceed in this manner is necessary to write the header X-JSON
> object with the contents of the JSON...
This is just a useful way to send *additional* data related to the
response on top of the primary response. So for instance, you might
respond with text/html data but include an X-JSON header to supply
further information about it.
For what you're doing (an Ajax request specifically to get the data),
I don't see any advantage; just keep doing what you're doing server-
side and start using the responseJSON property.
HTH,
--
T.J. Crowder
Independent Software Consultant
tj / crowder software / com
www.crowdersoftware.com
On Nov 19, 5:39 pm, Moisés Gramary Barbosa <
moigram...@gmail.com>
wrote: