Advertisement
freddy0512

controller

Nov 7th, 2014
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
  2.  
  3. class Welcome extends CI_Controller {
  4.  
  5. function __construct()
  6. {
  7. parent::__construct();
  8. $this->load->helper(array('url'));
  9. $this->load->model('modvsiswa');
  10. $this->load->database();
  11. }
  12.  
  13. public function index()
  14. {
  15. $this->load->view('welcome_message');
  16. }
  17. public function autocomplete(){
  18.  
  19. $this->load->model('modvsiswa');
  20. $q = $_REQUEST['term'];
  21. $cn = new modvsiswa();
  22. $data = $cn->siswaPerpusUnregister($q);
  23. $count = count($data);
  24. $jumlah = 0;
  25. $jumlah = ($count > 0 ? " : ");
  26. $response = array();
  27. foreach ($data as $val => $r){
  28. array_push($response, array("id"=>$r['nis'],
  29. "label"=>$r['nis']." = ".$r['nama'],"value"=>$r['nis']));
  30. }
  31. echo json_encode($response);
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement