> I noticed, the Autocomplete plugin waits for String-Array or Object-Array,
> (which
> starts and ends with [ ...] )  but my code always starts and ends with {
> ... } (JSON object type).
> I tried many perl data-structure, but always starts with { ...
>
> Original working response (with HTML header):
>
> [ { "id": "Acrocephalus agricola", "label": "Paddyfield Warbler", "value": 
> "Paddyfield Warbler" } ]
>
> My not woking response with JSON header:
> {"value":"Common Shelduck","id":"Tadorna tadorna","label":"Common Shelduck"}
>
>
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: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to