[eluser]kre8ivdesigns[/eluser]
So I am building a very database centric website and want to know what is the best way to recall data for something like JQuery autocomplete. I have a table that holds college information. As of now I have Phil Sturgeons Cache file for the get_colleges function and calling that as variables in the view. Looking for feedback:
Code:
$colleges = $this->user_profile->get_form_data_tables('college');
$this->cache->write($colleges, 'college');
$data['colleges'] = $this->cache->get('college');
in my views
Code:
var availableTags = [<?php foreach($colleges as $key) { echo '{"value":"'.ucwords($key->name).'","id":'.$key->college_id.'},'; }?>];
$("input#college").autocomplete({
source: availableTags,
select: function(event,ui){
$('#college_value').val(ui.item.id)}
});