i have a class called comment and inside i have 3 functions called __construct, index and getComments
Class comment extends CI_Controller
{
public function __construct(){
parent::__construct();
}
public function index($comment_id){
echo $comment_id;
}
public function getComments(){
//do stuff to get comments and print them to screen
}
}
also in my routes folder i have added a new route
$route['comment/(:any)'] = "comment/index/$1";
so when i go to mysite.com/comment/123131313123
it echos the comment id but when i do an ajax call to the getComments() function in the same class it wont work and instead it will show me the word "getComments"
how can i make sure that when i go direct to the index function it will show me the parameter and also be able to do ajax calls without having any other problem with the other functions?
Thanks.