[Catalyst] implementing ajax
Ashley
apv at sedition.com
Wed Mar 12 17:53:26 GMT 2008
On Mar 12, 2008, at 10:11 AM, Jennifer Ahn wrote:
> I'm sure that JSON and all the other goodies are perfect tools for
> implementing ajax, but i would like to learn what's really going on
> in teh black box before I use it.
>
> So far, my javascript is able to send an xmlhttprequest to my
> catalyst controller method which then does some processes and
> outputs data into an xml document. i'm having trouble sending that
> document over to my xmlhttprequest.responseXML object.
> in my controller:
> my $writer = new XML::LibXML::Document;
> ... do some process and spit out into an xml document...
> $c->response->content_type('text/xml');
> $c->response->write($writer);
I think that should be (or at least would work as)-
$c->response->content_type('application/xml'); # text/xml is
deprecated
$c->response->body($writer->serialize);
-Ashley
More information about the Catalyst
mailing list