I have model that returned an object like this :
MODEL
public function getAllNama() {
$this->db->select('nama');
$query = $this->db->get('tbl_user');
return $query->result();
}
Controller
$data['users'] = $this->model_user->getAllNama();
$this->load->view('it_team/view_manual_entry', $data);
In view, I have a problem to manipulate it on html. In my case, I use auto completed based jquery like this
<input id="data_user"type="text" data-provide="typeahead" data-items="4"
data-source='[<?= ?>]'
">
Which is, in atribute data-source
have a string format like this : data-source="["nama1", "nama2"]"
So, based that,
foreach(users as user){
echo $user->nama;
}
which is print user1user2, How can I pass this on data-source with suitable string format ?
I know implode, but i have try many ways, but still no success. Any solution it so appreciated.. Thanks