class Controller_Search extends Controller_Rest { public function get_titles() { $result = DB::select('*')->from('titles')->where('title', 'like', '%'.Input::get('term').'%'->limit(10)->as_object()->execute(); $data['response'] = 'true'; //I don't know why Phil does this $data['message'] = array(); foreach($result as $row) { $data['message'][] = array( 'label' => $row->title, 'value' => $row->title); } $this->response($data); } }
{"response":"true","message":[{"label":"Esc\u00e1ndalo en Bohemia","value":"Esc\u00e1ndalo en Bohemia"},{"label":"A Scandal in Bohemia","value":"A Scandal in Bohemia"}]}BUT if I print the array everything looks fine!
Array ( [response] => true [message] => Array ( [0] => Array ( [label] => Escándalo en Bohemia [value] => Escándalo en Bohemia ) [1] => Array ( [label] => A Scandal in Bohemia [value] => A Scandal in Bohemia ) ) )
It looks like you're new here. If you want to get involved, click one of these buttons!