Php Datatable Ajax请求进入Codeigniter控制器

Php Datatable Ajax请求进入Codeigniter控制器,php,jquery,ajax,codeigniter,Php,Jquery,Ajax,Codeigniter,我试图通过AJAX数据发送此URLwww.example.com/country/af.html的最后一个值(af),希望在Codeigniter Controller中读取此数据,但无法检索数据。请帮忙 数据表Ajax代码 $(document).ready(function() { var UserURL = window.location.href.split("/").pop(); var newurl = UserURL.split("/").slice(-1).joi

我试图通过AJAX数据发送此URL
www.example.com/country/af.html
的最后一个值(af),希望在Codeigniter Controller中读取此数据,但无法检索数据。请帮忙

数据表Ajax代码

$(document).ready(function() {
    var UserURL = window.location.href.split("/").pop();
    var newurl = UserURL.split("/").slice(-1).join().split(".").shift();
    $('#countryiptable').DataTable({
        "pageLength": 50,
        "info": false,
        "processing": true,
        "serverSide": true,
        'ajax': {
            'url': "country/getlist",
            "type": "POST",
            "data":{"country_code": newurl},
            "dataType": "json",
            "dataSrc": function (jsonData){
                return jsonData.data;
            }
        }
    });
} );
这是我的Codeigniter控制器

    public function getlist(){

        echo $this->input->post('country_code');
        $countryiso2    = strtoupper($this->input->post('country_code'));       
        //echo "hi";
        $list = $this->CountryModel->getCountry($countryiso2);

        $data = array();
        $no = $_POST['start'];
        foreach ($list as $iplist) {
        // print_r($data);die;
        $no++;
        $row = array();
        $row[] = $no;
        $row[] = $iplist->startip;
        $row[] = $iplist->registry_name;
        $row[] = $iplist->totalip;
        $row[] = $iplist->country_code;
        $row[] = $iplist->ip_type;

        $data[] = $row;

        //$_POST['draw']='';
        }

        $output = array(
            "draw" => $_POST['draw'],
            "recordsTotal" => $this->CountryModel->count_all(),
            "recordsFiltered" => $this->CountryModel->count_filtered(),
            "data" => $data,
        );
        //output to json format
       echo json_encode($output);
    }
}

尝试将数据作为newurl发送,而不是json数组country\u code:newurl。然后,只需使用这个->输入->post(),看看这是否为您提供了字符串
af
I无法将“数据”{“country\u code”:newurl}输入到Codeigniter中。我不确定,如何检查这些数据是否将发送到控制器。您的数据表何时发送ajax?那不是为了分页吗?每次用户单击下一页时,都会调用ajax以获取下一页数据的内容。这些值是什么??