[Catalyst] Using Jquery UI Autocomplete widget with
Catalyst::View::JSON
Rodrigo
rodrigolive at gmail.com
Sun Apr 25 21:00:33 GMT 2010
> 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 Shelduc=
k"}
>
>
Have you tried this?
sub request : Local {
my ($self,$c) =3D @_;
$c->stash->{json} =3D [ { id=3D>"Acrocephalus agricola", label=3D> "Pad=
dyfield
Warbler", value=3D> "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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20100425/b96e2=
b38/attachment.htm
More information about the Catalyst
mailing list