[Catalyst] Using Jquery UI Autocomplete widget with Catalyst::View::JSON

Hetényi Csaba csabiwork at tata.hu
Mon Apr 26 06:40:31 GMT 2010


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/




More information about the Catalyst mailing list