[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cgiapp] Re: cgiapp plug JSON.


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


#####  CGI::Application community mailing list  ################
##                                                            ##
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.