Autosuggest


Controller

<? p h p
class Test_autosuggest extends CI_Controller{
function index(){
$data=array(‘content’=>$this->populate_content());
$this->load->view(‘common/header’);
$this->load->view(‘test_autosuggest’,$data);
$this->load->view(‘common/footer’);
}
function populate_content(){
return “[‘satu’,’dua’,’tiga’,’empat’,’lima’,’enam’]”;
}
}

View

<s cr ipt type=”text/javascript”>
$(document).ready(function(){
var isi=<?php echo $content;?>;//[‘satu’,’dua’,’tiga’,’empat’];
$(‘#teks’).autocomplete({source:isi});
});
</s cr ipt>
<?p h   p
$teks=array(‘id’=>’teks’,’name’=>’teks’,’class’=>’teks’);
echo form_input($teks);

 

About abunajiyah
A Programmer

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: