HTTP请求上的404

When I try to make an ajax request to a codeigniter route I get an 404 error

The root folder of the project is http://localhost/control_cuotas/

this is the controller(index works):

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

class Control_cuotas_controller extends CI_Controller {

    public function index()
    {
        $data = array();
        $tables = $this->getTables();
        $data['tables'] = $tables;
        $this->load->view('main/main_view', $data);      
    }

    public function getData($data){
        var_dump($data);
    }

    private function getTables(){

        $sql = "SELECT TABLE_NAME " 
            ."FROM INFORMATION_SCHEMA.TABLES "
            ."WHERE TABLE_TYPE = 'BASE TABLE' AND TABLE_NAME LIKE 'datos_%'";
        $query = $this->db->query($sql);
        $tables = array();

        foreach ($query->result() as $row){
            $name = substr($row->TABLE_NAME,0,-2);
            if(!in_array($name,$tables)){
                array_push($tables, $name);
            }
        }

        return $tables;
    }

and this is the javascript:

$(document).ready(function(){

    $('#tables').change(function(){
        var selected = $(this).val();
        $.ajax({
            url:'getData/'+selected
        });
    });
});
}

an this is the route

$route['getData/(:any)']['GET'] = 'control_cuotas_controller/getData/$1';

The request is done on the following url

http://localhost/control_cuotas/getData/selected_value

Please Check .htaccess file

and Try this code;

RewriteEngine on
RewriteCond $1 !^(index\.php|public|\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1

OR

$(document).ready(function(){

    $('#tables').change(function(){
        var selected = $(this).val();
        $.ajax({
            url:'http://localhost/control_cuotas/getData/'+selected
        });
    });
});
}

You haven't added .htaccess code to remove index.php from the URL. Either do that or in your JavaScript change the URL as http(:)//localhost/control_cuotas/index.php/getData