如何从数据库中获取数据并将其与自动完成和Bootstrap Tagsinput一起使用? 在Code Igniter中

I have gone through Bootstrap Tags Input docs and identified one of the examples provided and i am using it to integrate tags input in my senders field in the view. The problem i have is calling the controller in my script which fetches data from the database. Please help

Here is my script, controller and model respectively:

<script>
    //we are one
 
    $(document).ready(function() {
        var contactdetails = new Bloodhound({
              datumTokenizer: Bloodhound.tokenizers.obj.whitespace('text'),
              queryTokenizer: Bloodhound.tokenizers.whitespace,
              prefetch: '<?php echo base_url('tags/get_tags');?>'
            });
            contactdetails.initialize();

            var elt = $('input-tag');
            elt.tagsinput({
              itemValue: 'value',
              itemText: 'text',
              typeaheadjs: {    
                name: 'contactdetails',
                displayKey: 'text',
                source: contactdetails.ttAdapter()
              }
            });
            elt.tagsinput('add', { "value": 1 , "text": "Charles"   , "continent": "Europe"    });
            elt.tagsinput('add', { "value": 4 , "text": "David"  , "continent": "America"   });
            elt.tagsinput('add', { "value": 7 , "text": "Peter"      , "continent": "Australia" });
            elt.tagsinput('add', { "value": 10, "text": "Sam"     , "continent": "Asia"      });
            elt.tagsinput('add', { "value": 13, "text": "Ritchie"       , "continent": "Africa"    });
        });

    });

</script>

<?php defined( 'BASEPATH' ) OR die('No direct script access allowed!');

    class tags extends CI_Controller {
        function __construct() {
          parent::__construct();
            $this->load->database(); // load database
            $this->load->model('tags_model');

        }

        function get_tags($number) {
     $res =  $this->tags_model->get_tag($number);
    echo "<pre>";  print_r($res);     }
     }

    }

    /* End of file sms.php */

<?php defined( 'BASEPATH' ) OR die('No direct script access allowed!');

class tags_model extends CI_Model {
    function __construct() {
        // Call the Model constructor
        parent::__construct();
    }

 function get_tag($number){
  $this->db->select("firstname,lastname,number"); 
  $this->db->from('contactdetails', $number);
  $query = $this->db->get();
  return $query->result();
 }

}

/* End of file sms.php */ 

</div>