[Catalyst] TT via AJAX

Roland Philibert rphilibert at aptina.com
Thu Apr 26 14:03:06 GMT 2012


Hi Jason.

 =


If I remove the end action and wite $body in the log, I do get what I want =
(ie rendered html from my TT with its "result" variable).

...so your conclusion about not serializing the @content seems to be on the=
 right track. =

...is this liked to what Will has suggested to get around this issue? What =
do you suggest I do next?

 =


Thanks

R.

 =


From: Jason Galea [mailto:lists at eightdegrees.com.au] =

Sent: 26 April 2012 14:32
To: The elegant MVC web framework
Subject: Re: [Catalyst] TT via AJAX

 =


 =


Hi Roland,

 =


On Wed, Apr 25, 2012 at 11:26 PM, Roland Philibert <rphilibert at aptina.com> =
wrote:

Hello all,

I'd like to render some HTML content being formatted from a  TT view via AJ=
AX.
Can anybody recommend a way to do that please?

 =


The method I am using now for AJAX  is REST controller and JSON View.

 =


...

sub ajaxaction :Local :ActionClass('REST') {}

 =


sub ajaxaction _GET {

 =


                my ($self, $c) =3D @_;

                my $rs =3D  $c->model(DN)->resultset(Table)->find(...);

                my $body =3D $c->view(MYTT)->render($c,'dir/temp.mailtt',$c=
->stash( result  =3D> [ $rs ] )); =DF this is the weird bit I guess.

                my @content =3D();

                push @content, $body;

                $self->status_ok(

                        $c,

                        entity =3D> \@content,

                );

}

sub end :Private {

        my ($self, $c) =3D @_;

        $c->forward("View::JSON");

}

 =


..but doing this I get the error:

 =


Caught exception in MyApp::View::JSON->process "encountered object 'MyApp::=
Model::DB::Table=3DHASH(0xdb2c330)', but neither allow_blessed nor convert_=
blessed settings are enabled at (eval 1606) line 151."

 =


have you tried this without the 'end' action?

 =


What is MyApp::View::JSON trying to serialize? or what module are you subcl=
assing?

 =


Looks to me like $body should be what you think it is (have you confirmed t=
hat?) but I don't think  MyApp::View::JSON is serializing your content arra=
y, but instead is attempting to serialize the "result" in your stash.

 =


cheers,

 =


J

 =


	 =


	Thanks for your help.

	Roland

	 =


	 =


	 =


	 =


	 =


	 =


	 =


	 =


	 =


	 =


	 =


	 =


	 =


	 =


	 =


	 =


	 =


	 =


	 =


	 =


	 =


	 =


	 =


	 =


	 =


	Aptina (UK) Limited, Century Court, Millennium Way, Bracknell, Berkshire, =
RG12 2XT. Registered in England No. 06570543.
	 =

	This e-mail and any attachments contain confidential information and are s=
olely for the review and use of the intended recipient. If you have receive=
d this e-mail in error, please notify the sender and destroy this e-mail an=
d any copies.
	 =


	=

	_______________________________________________
	List: Catalyst at lists.scsys.co.uk
	Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
	Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
	Dev site: http://dev.catalyst.perl.org/

 =



Aptina (UK) Limited, Century Court, Millennium Way, Bracknell, Berkshire, R=
G12 2XT. Registered in England No. 06570543.

This e-mail and any attachments contain confidential information and are so=
lely for the review and use of the intended recipient. If you have received=
 this e-mail in error, please notify the sender and destroy this e-mail and=
 any copies.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20120426/563bf=
fbd/attachment.htm


More information about the Catalyst mailing list