jquery - CakePHP Submit Search Field during entry threw Ajax -
in cakephp app have search field set , working properly:
/* title search */ if (!empty($this->data)) { $title = $this->data['post']['title']; $conditions = array( 'conditions' => array( 'and' => array( 'post.title like' => "%$title%", 'post.status_id =' => '1' ) ) ); $this->set('posts', $this->post->find('all', $conditions)); } what trying achieve adding jquery/ajax submit form automatically during text entry , load search results "on fly". either on every other character, or on time intervals ...
most, if not all, information find on topic meant cake 1.x , doesn't work here. feature looking should similar autocomplete search field of cakes documentation.
can point me in right direction? (i new of this)
well, first off, there 2 parts it: - server side (in controllers , or models) - client side (in views / js library)
in controller need make function similar posted. have accept wanted title argument. best return result json.
in view need form (obviously) , javascript use ajax call submit query , function process result.one out of box jquery ui autocomplete function http://www.devbridge.com/projects/autocomplete/jquery/
Comments
Post a Comment