hola el código del controladores muy sencillo
<?php class CarsController extends AppController { public $layout = 'basic'; public $components = array <http://www.php.net/array>('RequestHandler'); public function index() { if ($this->request->is('ajax')) { $term = $this->request->query('term'); $carNames = $this->Car->getCarNames($term); $this->set(compact <http://www.php.net/compact>('carNames')); $this->set('_serialize', 'carNames'); } } } El divendres, 9 octubre de 2015 7:06:21 UTC+2, Christian Quispe va escriure: > > Ahiy esta el error. Hay un problema con la función. > > Este tema del jquey, ajax y json es bien fácil. Fresh. Compartenos el > código del controlador para ver en que has metido la pata > > Enviado desde Gmail para Moto G > > www.oxicode.io > El oct. 8, 2015 2:08 AM, "Raul Magdalena Catala" <raulma...@gmail.com > <javascript:>> escribió: > >> Hola Christian, >> >> tengo un archivo creado para la vista en , src/Template/Cars/index.ctp. >> >> la ruta en el script es correcta: >> >> $(document).ready(function(){ >> $('#autocomplete').autocomplete({ >> source: "/cars/index.json", >> }); >> }); >> >> finalmente te paso la pertaña network >> >> >> <https://lh3.googleusercontent.com/-2kiB-wJjJGY/VhYWOcbmc-I/AAAAAAAAeJM/7_r3HcpdTQo/s1600/Captura%2Bde%2B2015-10-08%2B09%253A06%253A59.png> >> >> >> >> El dijous, 8 octubre de 2015 0:57:13 UTC+2, Christian Quispe va escriure: >>> >>> Ya veo, el problema viene por la vista, tienes el archivo creado en la >>> vista?, si usas solo controlador debes tener >>> >>> $this->set('_serialize', ['articles']); >>> >>> tambien checa la ruta, la url destino, el u0022 es un ' por ahi puede >>> hacer conflicto >>> pasame un pantallazo de la pestaña Network, el ultimo item debe ser el >>> request, subpestaña preview >>> >>> >>> >>> Enviado con MailTrack >>> <https://mailtrack.io/install?source=signature&lang=es&referral=christian.quis...@gmail.com&idSignature=23> >>> >>> Saludos >>> >>> Christian Quispe >>> >>> *Geek and Developer* >>> *Miembro: * *GDG Lima (Google Developer Group Lima)* >>> >>> *Portafolio: www.oxicode.io >>> <https://mailtrack.io/trace/link/8ec7b946fa3dd757dcc0aee0f3b541981f2635a3?url=http%3A%2F%2Foxicode.io&signature=1f56e26077e1b222>* >>> >>> *¿A quién le enseñan sus aciertos?, si yo aprendo de mis errores >>> constantemente...* >>> >>> >>> 2015-10-07 17:09 GMT-05:00 Raul Magdalena Catala <raulma...@gmail.com>: >>> >>>> Gracias Christian, >>>> >>>> ya he consegido, creo, que se realice la llamada cuando escribo algo en >>>> el input >>>> >>>> >>>> <https://lh3.googleusercontent.com/-SBR0rzGlShc/VhWXCkVuB7I/AAAAAAAAeIs/h7KqDfMMpyU/s1600/Selecci%25C3%25B3_001.png> >>>> >>>> >>>> pero siguen sin autocompletarse. >>>> Ahora cuando escribo la misma url ( >>>> http://localhost:8765/cars/index.json?term=fo) directamente en el >>>> navegador, me responde: >>>> >>>> { >>>> "message": "Template file \u0022Cars\/json\/index.ctp\u0022 is >>>> missing.", >>>> "url": "\/cars\/index.json?term=fo", >>>> "code": 500 >>>> } >>>> >>>> >>>> >>>> saludos >>>> >>>> El dimecres, 7 octubre de 2015 23:48:49 UTC+2, Christian Quispe va >>>> escriure: >>>>> >>>>> Hola Raul >>>>> Nos compares los debugs? o algún pantallazo de la consola de chromeDev >>>>> cuando intentas ejecutarlo >>>>> >>>>> >>>>> >>>>> Enviado con MailTrack >>>>> <https://mailtrack.io/install?source=signature&lang=es&referral=christian.quis...@gmail.com&idSignature=23> >>>>> >>>>> Saludos >>>>> >>>>> Christian Quispe >>>>> >>>>> *Geek and Developer* >>>>> *Miembro: * *GDG Lima (Google Developer Group Lima)* >>>>> >>>>> *Portafolio: www.oxicode.io >>>>> <https://mailtrack.io/trace/link/f90a24cbce9603049712749436540c6015285ce9?url=http%3A%2F%2Foxicode.io&signature=b56e083071470d63>* >>>>> >>>>> *¿A quién le enseñan sus aciertos?, si yo aprendo de mis errores >>>>> constantemente...* >>>>> >>>>> >>>>> 2015-10-07 16:42 GMT-05:00 Raul Magdalena Catala <raulma...@gmail.com> >>>>> : >>>>> >>>>>> Hello, >>>>>> i'm trying to use the following example of JQuery autocomplete with >>>>>> Cakephp >>>>>> >>>>>> >>>>>> http://zenofcoding.com/2013/08/27/cakephp-and-jquery-auto-complete-revisited/ >>>>>> >>>>>> The important change between versions (if i'm not wrong) is how to >>>>>> enable the parsing of extensions >>>>>> >>>>>> in both cases it is done in the ruotes.php file >>>>>> in 2.3 by Router::parseExtensions() >>>>>> in 3.0 by Router::extensions('json') >>>>>> >>>>>> anyway, when i write into the input, nothing happens >>>>>> i've checked with the browser debugging tool and no call to >>>>>> http://localhost:8765/cars/index.json occurs. >>>>>> even if i write the url http://localhost:8765/cars/index.json?term=fo >>>>>> in the browser, i do not receive a json response, in fact no response or >>>>>> error message >>>>>> >>>>>> any idea about what i'm doing wrong? >>>>>> >>>>>> -- >>>>>> Like Us on FaceBook https://www.facebook.com/CakePHP >>>>>> Find us on Twitter http://twitter.com/CakePHP >>>>>> >>>>>> --- >>>>>> You received this message because you are subscribed to the Google >>>>>> Groups "CakePHP" group. >>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>> send an email to cake-php+u...@googlegroups.com. >>>>>> To post to this group, send email to cake...@googlegroups.com. >>>>>> Visit this group at http://groups.google.com/group/cake-php. >>>>>> For more options, visit https://groups.google.com/d/optout. >>>>>> >>>>> >>>>> -- >>>> Like Us on FaceBook https://www.facebook.com/CakePHP >>>> Find us on Twitter http://twitter.com/CakePHP >>>> >>>> --- >>>> You received this message because you are subscribed to the Google >>>> Groups "CakePHP" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to cake-php+u...@googlegroups.com. >>>> To post to this group, send email to cake...@googlegroups.com. >>>> Visit this group at http://groups.google.com/group/cake-php. >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> >>> -- >> Like Us on FaceBook https://www.facebook.com/CakePHP >> Find us on Twitter http://twitter.com/CakePHP >> >> --- >> You received this message because you are subscribed to the Google Groups >> "CakePHP" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to cake-php+u...@googlegroups.com <javascript:>. >> To post to this group, send email to cake...@googlegroups.com >> <javascript:>. >> Visit this group at http://groups.google.com/group/cake-php. >> For more options, visit https://groups.google.com/d/optout. >> > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.