Created
April 16, 2013 10:20
-
-
Save rohman/5394859 to your computer and use it in GitHub Desktop.
Belajar TypeHead Bootstrap CI
This file contains 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
<?php | |
class Tamu extends CI_Controller | |
{ | |
public $data; | |
function __construct() | |
{ | |
parent::__construct(); | |
} | |
function cari() | |
{ | |
$this->load->helper('url'); | |
$this->load->view('tamu_cari', $this->data); | |
} | |
function searchTamu() | |
{ | |
$this->load->model('tamu_model'); | |
$nama = $this->input->post('nama'); | |
$limit = $this->input->post('limit'); | |
$getTamu = $this->tamu_model->cariTamu($nama, $limit); | |
$res = array(); | |
if(!empty($getTamu)) | |
{ | |
foreach($getTamu->result() as $row) | |
{ | |
$res[] = array('label' => $row->id, 'value' => $row->nama); | |
} | |
} | |
else | |
{ | |
$res[] =""; | |
} | |
echo json_encode($res); | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment