Hi,
inside the controller create a function to retrieve the sub-category, and then point your javascript to that link, I'm supposing you will use ajax for this. So inside the controller you write a simple function:
public function get_subcat()
{
$cat = $this->uri->segment(3);
$this->db->where('category',$cat);
$d['query'] = $this->db->get('table_to_query');
$this->load->view('subcat',$d);
}
inside the view you can return plain text or json, in this example you will get json:
<?php
if($query->num_rows() != 0)
{
$result = array();
foreach($query->result() as $row)
{
$result[] = $row->subcategory;
}
json_encode($result);
}
?>
to access the data just point the ajax call to /controller/get_subcat/category_name
cereal
Veteran Poster
1,146 posts since Aug 2007
Reputation Points: 344
Solved Threads: 223
Skill Endorsements: 22
If you add a function to the controller as my previous example:
/controller_name/ajax_category/category_id
you can change ShiftChanger() to this:
ShiftChanger('shiftcontainer','ajax_category',value);
and at line 28 change:
AjaxObjects[ajaxIndex].requestFile = url+"/"+id;
then I think it should work, the resulting link will be something like: /categories/ajax_category/12
cereal
Veteran Poster
1,146 posts since Aug 2007
Reputation Points: 344
Solved Threads: 223
Skill Endorsements: 22