Using AutoSuggest in CodeIgniter

rjyanyan18's Avatar

rjyanyan18

14 Mar, 2013 03:04 AM

Hello Everyone! I need help in using the autosuggest plugin. I'm applying this plugin in CodeIgniter. I'm not sure where is the problem.
When I open the chrome dev tools console. I saw url/page?q=C (404 not found).
Please have a look at my code

view


$(function() { $('#attachment').autoSuggest("<?php echo base_url('documents/get_bar_codes.php'); ?>");

});

controller

public function get_bar_codes()
{ $this->load->model('documents_model'); $data = $this->documents_model->get_reference_number(); echo json_encode($data);

}

model

public function get_reference_number()
{ $query = $this ->db ->select('reference_number') ->like('reference_number', mysql_real_escape_string($_GET["q"])) ->limit(10) ->get('documents'); $data = array(); foreach ($query->result() as $row)
{ $data[] = $row->reference_number; } return $data;
}

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Already uploaded files

  • Untitled.png 10.2 KB

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac