Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在CodeIgniter中获取服务器端AJAX查询的参数?_Ajax_Codeigniter - Fatal编程技术网

如何在CodeIgniter中获取服务器端AJAX查询的参数?

如何在CodeIgniter中获取服务器端AJAX查询的参数?,ajax,codeigniter,Ajax,Codeigniter,我有AJAX代码,它调用CodeIgniter后端的控制器: <script> $(document).ready(function(){ $("#select_bank").change(function(){ selected_bank = $("#select_bank option:selected").text(); $.ajax({

我有AJAX代码,它调用CodeIgniter后端的控制器:

<script>
    $(document).ready(function(){

            $("#select_bank").change(function(){
                selected_bank = $("#select_bank option:selected").text();

                $.ajax({
                    url:'<?=base_url().'atm/select_region/&'+selected_bank; ?>',
                    success:function(msg){

                    }
                });

            });

    });

不起作用。真的,我想澄清一下,现在您需要告诉ajax函数您正在发送POST数据

$.ajax({
                type: "POST",
                dataType: 'html',
                url: <?= base_url ?> + "atm/select_region",
                data: {nameofpostvariable:valuethatyousend},
                success: function(output){

                },
                error: function(output){                
                    alert('error');                         
                }               
            });
$.ajax({
类型:“POST”,
数据类型:“html”,
url:+“atm/选择区域”,
数据:{nameofpostvariable:valuethatyousend},
成功:功能(输出){
},
错误:函数(输出){
警报(“错误”);
}               
});
data:{nameofpostvariable:valuethatyousend}行上,
您正在创建一个$\u POST['nameofpostvariable']

$.ajax({
                type: "POST",
                dataType: 'html',
                url: <?= base_url ?> + "atm/select_region",
                data: {nameofpostvariable:valuethatyousend},
                success: function(output){

                },
                error: function(output){                
                    alert('error');                         
                }               
            });