[Catalyst] Using Jquery UI Autocomplete widget
with Catalyst::View::JSON
Ben van Staveren
benvanstaveren at gmail.com
Mon Apr 26 06:47:27 GMT 2010
Looks like you need to set
expose_stash => 'json'
in your config.
Hetényi Csaba wrote:
> Dear Rodrigo
>
> I tired your tip, but my response is:
>
> {"json":[{"value":"Paddyfield Warbler","label":"Paddyfield
> Warbler","id":"Acrocephalus agricola"}]}
>
> and -of course- there is no any suggest. :(
>
> I thought that Catalyst::View::JSON translate perl datastructures to
> corresponding JSON data structure ( hash > object ... as i see on
> http://www.json.org) automatically. ( if not, i could use manually
> created JSON formatted string without any JSON module)
>
> Thank You!
>
>
>>
>>
>> Have you tried this?
>>
>> sub request : Local {
>> my ($self,$c) = @_;
>> $c->stash->{json} = [ { id=>"Acrocephalus agricola", label=>
>> "Paddyfield Warbler", value=> "Paddyfield Warbler" } ];
>> $c->forward('View::JSON');
>> }
>>
>> It gives me back the following response:
>>
>> $ curl http://localhost:3000/request <http://localhost:3000/test>
>> [{"value":"Paddyfield Warbler","id":"Acrocephalus
>> agricola","label":"Paddyfield Warbler"}]
>>
>> Which works with JQuery's autocomplete example just fine
>>
>> -rodrigo
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> 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/
>
>
> _______________________________________________
> 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/
>
--
Ben van Staveren
phone: +62 81 70777529
email: benvanstaveren at gmail.com
More information about the Catalyst
mailing list