Created
September 19, 2014 12:57
-
-
Save taleeb35/f96d0c64a85006ec3bae to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public function find() { | |
| if ($this->request->is('ajax')) { | |
| $this->autoRender = false; | |
| $country_name = $this->request->data['Country']['name']; | |
| $results = $this->Country->find('all', array( | |
| 'conditions' => array('Country.name LIKE ' => '%' . $country_name . '%'), | |
| 'recursive' => -1 | |
| )); | |
| $resultArr = array(); | |
| foreach($results as $result) { | |
| $resultArr[] = array('label' =>$result['Country']['name'] , 'value' => $result['Country']['name'] ); | |
| } | |
| echo json_encode($resultArr); | |
| //exit(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment