public function rest() { $q = $this->request->get('q'); $dicts = Db::name($this->table)->where('dvalue','like','%'.$q.'%')->field('dvalue')->select(); return json(data2arr($dicts,'dvalue')); }
require(['jqueryui1121', 'dragpanel'], function () { dragpanel.init(); $('.packing').autocomplete({ source: function( request, response ) { $.ajax({ url: '{:url("admin/dict/rest")}', data: { q: request.term }, success: function( data ) { response( data ); } }); } }); });