表單自動完成
阿新 • • 發佈:2017-11-12
name ajax pack .ajax like pub req gpa tab
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 ); } }); } }); });
表單自動完成