[Catalyst] jquery autocomplete and JSON
    Lee 
    leegee at gmail.com
       
    Fri Apr 29 12:17:29 GMT 2011
    
    
  
Remember 'same domain' includes same port.
If you have two servers on the same host and it isn't working for you =
because on is on a different port, you can try something like this in =
your Apache config:
     RewriteEngine ON
     RewriteRule ^/ajax/(.+) http://localhost:3000/$1 [P,L]
There all requests to loalhost/ajax get redirected to localhost:3000, =
which might be your Catalyst app server with View::JSON. No need for =
JSONP then.
HTH
Lee
On 29/04/2011 14:10, Oroszi, R=F3bert wrote:
> Dmitry, you should return JSONP only for crossdomain requests.
> if you are on the same domain and port you can send JSON.
>
> 2011/4/29 Dmitry L. <dim0xff at gmail.com <mailto:dim0xff at gmail.com>>
>
>     Hi!
>
>     Your controller must return JSONP data (not just JSON)
>
>     jQuery send additional param to you controller ("callback" by
>     default, I
>     think)
>     my $cb =3D $c->req->param("callback");
>
>     So View::JSON should return something like this: $cb($data);
>     Where $data is
>     [{"value":"1","label":"betty"},{"value":"2","label":"jane"},
>     {"value":"3","label":"marge"}]
>
>     And Content-type header probably should be "application/javascript"
>
>     Or look at jQuery.autocomplete manual to use JSON (instead of JSONP)
>
>     --
>     //wbr, Dmitry L.
>
>     _______________________________________________
>     List: Catalyst at lists.scsys.co.uk <mailto: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.u=
k/
> Dev site: http://dev.catalyst.perl.org/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20110429/6ac44=
dec/attachment.htm
    
    
More information about the Catalyst
mailing list