[cgiapp] Re: cgiapp plug JSON.
Michael Peters
mpeters at plusthree.com
Sun Jan 20 17:20:44 EST 2008
Neil Mansilla wrote:
> Hi there,
CC'ing the cgi-app list:
> Can you give me a little tip on how to get the plugin to properly work
> with CGIapp in terms of changing the content-type and sending the data
> out to the application properly?
It should be pretty straight forward.
> I'm using prototype.js to observe one
> of my form fields and onchange it runs my CGIapp runmode "foo_ajax".
> I'd like to instruct my CGIapp to use the JSON plugin so that the data
> is properly sent back in as compact way as possible.
Are you trying to send JSON data in the HTTP X-JSON header or as the contents of
the response? If the header, just do:
$self->json_header(foo => 'bar');
Somewhere in your run mode. If your sending the JSON as the contents of the
response then it's just:
return $self->json_body({ foo => 'bar' });
at the end of your run mode.
> I'm trying to set the header_type to none, etc.. but I'm just getting a
> lot of Error 500s and other errors from CGIapp.
A 500 error means *look in your server log* :)
--
Michael Peters
Developer
Plus Three, LP
More information about the cgiapp
mailing list