Monday 15 August 2011

How to implement jquery autocomplete using Zend framework 2? -


I'm looking for examples to implement Z-autism through Zend Framework 2.

On previous occasions with auto-completion using Java and ColdFusion, the http response should only be JSON data. But the zend usually adds a layout HTML (as defined by module config). I was thinking about using an empty layout file (content content;;;), but I'm not sure it's right to do this (i.e., the way).

Net search, but nothing can be found useful.

Can you please help with examples / links / etc? Thank you

To auto-complete, you should:

  1. A Create Controller responds to the JSO receiving or receiving the parameter by post.

      Public function search action () {// $ param = $ this- & gt; Params (); $ Count = $ Params-> FromQuery ('count', 10); $ Offset = $ params-> FromQuery ('offset', 0); $ Search = $ parachos- & gt; FromQuery ('search', blank); // Mapper $ search = TableMapper (); $ $ = $ Search-> Search (Search, $ count, $ offset)); // I think a good idea can make a peace service if you have another request header ('content-type: application / jsan'); Echo \ Zend \ Jason \ Jason :: Encoding (array ('condition' = & gt; true, 'data' => $ rs,)); Die ();   
    1. JQuery / Angle to collect letters typed in the field.

        $ ("# input") .keyup (function) {var stt = $ (this) .val (); / ** is the search path example, you can enter the correct url / route ** / $ .get ("/ search", function (response) {if (response.status == true) {$ (".result"). HTML (feedback);}});});      


No comments:

Post a Comment