Guest User

Untitled

a guest
Oct 23rd, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.51 KB | None | 0 0
  1. <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
  2.  
  3. class Autocomplete extends CI_Controller {
  4.  
  5.     function index()
  6.     {
  7.         $this->load->view('autocomplete');
  8.     }
  9.  
  10.     function suggestions()
  11.     {
  12.         // Search term from jQuery
  13.         $term = $this->input->post('term');
  14.  
  15.         // Do mysql query or what ever
  16.         $arr = array($term, 'testa', 'testb', 'testc');
  17.  
  18.         // Return data
  19.         echo json_encode($arr);
  20.     }
  21. }
  22.  
  23. /* End of file autocomplete.php */
  24. /* Location: ./application/controllers/autocomplete.php */
Add Comment
Please, Sign In to add comment